Skip to content

Commit 0709811

Browse files
committed
Merge pull request #12 from purescript/0.8-updates
Updates for PureScript 0.8
2 parents 3dd5bc5 + eb2c26a commit 0709811

File tree

9 files changed

+48
-94
lines changed

9 files changed

+48
-94
lines changed

.jscsrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
{
22
"preset": "grunt",
3+
"disallowSpacesInFunctionExpression": null,
4+
"requireSpacesInFunctionExpression": {
5+
"beforeOpeningRoundBrace": true,
6+
"beforeOpeningCurlyBrace": true
7+
},
38
"disallowSpacesInAnonymousFunctionExpression": null,
49
"requireSpacesInAnonymousFunctionExpression": {
510
"beforeOpeningRoundBrace": true,

.jshintrc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"freeze": true,
66
"funcscope": true,
77
"futurehostile": true,
8-
"globalstrict": true,
8+
"strict": "global",
99
"latedef": true,
1010
"maxparams": 1,
1111
"noarg": true,
@@ -15,5 +15,6 @@
1515
"singleGroups": true,
1616
"undef": true,
1717
"unused": true,
18-
"eqnull": true
18+
"eqnull": true,
19+
"predef": ["exports"]
1920
}

.travis.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
11
language: node_js
2-
sudo: false
3-
node_js:
4-
- 0.10
2+
sudo: required
3+
dist: trusty
4+
node_js: 5
55
env:
66
- PATH=$HOME/purescript:$PATH
77
install:
88
- TAG=$(wget -q -O - https://github.com/purescript/purescript/releases/latest --server-response --max-redirect 0 2>&1 | sed -n -e 's/.*Location:.*tag\///p')
99
- wget -O $HOME/purescript.tar.gz https://github.com/purescript/purescript/releases/download/$TAG/linux64.tar.gz
1010
- tar -xvf $HOME/purescript.tar.gz -C $HOME/
1111
- chmod a+x $HOME/purescript
12+
- npm install -g bower
1213
- npm install
14+
- bower install
1315
script:
1416
- npm run build
17+
after_success:
18+
- >-
19+
test $TRAVIS_TAG &&
20+
psc-publish > .pursuit.json &&
21+
curl -X POST http://pursuit.purescript.org/packages \
22+
-d @.pursuit.json \
23+
-H 'Accept: application/json' \
24+
-H "Authorization: token ${GITHUB_TOKEN}"

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ Call-by-need values.
1212
bower install purescript-lazy
1313
```
1414

15-
## Module documentation
15+
## Documentation
1616

17-
- [Data.Lazy](docs/Data/Lazy.md)
17+
Module documentation is [published on Pursuit](http://pursuit.purescript.org/packages/purescript-console).

bower.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
"John A. De Goes <john@degoes.net>"
88
],
99
"description": "Call-by-need values",
10-
"keywords": [
11-
"purescript"
12-
],
1310
"license": "MIT",
1411
"repository": {
1512
"type": "git",

docs/Data/Lazy.md

Lines changed: 0 additions & 63 deletions
This file was deleted.

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"private": true,
33
"scripts": {
4-
"postinstall": "pulp dep install",
5-
"build": "jshint src && jscs src && pulp build && rimraf docs && pulp docs"
4+
"clean": "rimraf output && rimraf .pulp-cache",
5+
"build": "jshint src && jscs src && pulp build"
66
},
77
"devDependencies": {
8-
"jscs": "^1.13.1",
9-
"jshint": "^2.8.0",
10-
"pulp": "^4.0.2",
11-
"rimraf": "^2.4.1"
8+
"jscs": "^2.8.0",
9+
"jshint": "^2.9.1",
10+
"pulp": "^8.1.0",
11+
"rimraf": "^2.5.0"
1212
}
1313
}

src/Data/Lazy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
exports.defer = function () {
77

8-
function Defer (thunk) {
8+
function Defer(thunk) {
99
if (this instanceof Defer) {
1010
this.thunk = thunk;
1111
return this;

src/Data/Lazy.purs

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
-- | A monad for lazily-computed values
2-
31
module Data.Lazy where
42

5-
import Prelude (class Show, class Monad, class Bind, class Applicative, class Apply, class Functor, class BooleanAlgebra, class Semigroup, class BoundedOrd, class Bounded, class Ord, class Eq, class Num, class DivisionRing, class ModuloSemiring, class Ring, class Semiring, Unit, unit, show, append, ($), (<<<), not, (<$>), (<*>), disj, conj, (<>), bottom, top, compare, (==), mod, (/), (-), one, (*), zero, (+))
3+
import Prelude
64

75
import Control.Comonad (class Comonad)
86
import Control.Extend (class Extend)
9-
import Data.Monoid (class Monoid, mempty)
107
import Control.Lazy as CL
118

9+
import Data.HeytingAlgebra (implies, ff, tt)
10+
import Data.Monoid (class Monoid, mempty)
11+
1212
-- | `Lazy a` represents lazily-computed values of type `a`.
1313
-- |
1414
-- | A lazy value is computed at most once - the result is saved
@@ -36,13 +36,14 @@ instance semiringLazy :: (Semiring a) => Semiring (Lazy a) where
3636
instance ringLazy :: (Ring a) => Ring (Lazy a) where
3737
sub a b = defer \_ -> force a - force b
3838

39-
instance moduloSemiringLazy :: (ModuloSemiring a) => ModuloSemiring (Lazy a) where
39+
instance commutativeRingLazy :: (CommutativeRing a) => CommutativeRing (Lazy a)
40+
41+
instance euclideanRingLazy :: (EuclideanRing a) => EuclideanRing (Lazy a) where
42+
degree = degree <<< force
4043
div a b = defer \_ -> force a / force b
4144
mod a b = defer \_ -> force a `mod` force b
4245

43-
instance divisionRingLazy :: (DivisionRing a) => DivisionRing (Lazy a)
44-
45-
instance numLazy :: (Num a) => Num (Lazy a)
46+
instance fieldLazy :: (Field a) => Field (Lazy a)
4647

4748
instance eqLazy :: (Eq a) => Eq (Lazy a) where
4849
eq x y = (force x) == (force y)
@@ -54,30 +55,33 @@ instance boundedLazy :: (Bounded a) => Bounded (Lazy a) where
5455
top = defer \_ -> top
5556
bottom = defer \_ -> bottom
5657

57-
instance boundedOrdLazy :: (BoundedOrd a) => BoundedOrd (Lazy a)
58-
5958
instance semigroupLazy :: (Semigroup a) => Semigroup (Lazy a) where
6059
append a b = defer \_ -> force a <> force b
6160

6261
instance monoidLazy :: (Monoid a) => Monoid (Lazy a) where
6362
mempty = defer \_ -> mempty
6463

65-
instance booleanAlgebraLazy :: (BooleanAlgebra a) => BooleanAlgebra (Lazy a) where
64+
instance heytingAlgebraLazy :: (HeytingAlgebra a) => HeytingAlgebra (Lazy a) where
65+
ff = defer \_ -> ff
66+
tt = defer \_ -> tt
67+
implies a b = implies <$> a <*> b
6668
conj a b = conj <$> a <*> b
6769
disj a b = disj <$> a <*> b
6870
not a = not <$> a
6971

72+
instance booleanAlgebraLazy :: (BooleanAlgebra a) => BooleanAlgebra (Lazy a)
73+
7074
instance functorLazy :: Functor Lazy where
7175
map f l = defer \_ -> f (force l)
7276

7377
instance applyLazy :: Apply Lazy where
74-
apply f x = defer \_ -> force f $ force x
78+
apply f x = defer \_ -> force f (force x)
7579

7680
instance applicativeLazy :: Applicative Lazy where
7781
pure a = defer \_ -> a
7882

7983
instance bindLazy :: Bind Lazy where
80-
bind l f = defer \_ -> force <<< f <<< force $ l
84+
bind l f = defer \_ -> force $ f (force l)
8185

8286
instance monadLazy :: Monad Lazy
8387

@@ -88,7 +92,7 @@ instance comonadLazy :: Comonad Lazy where
8892
extract = force
8993

9094
instance showLazy :: (Show a) => Show (Lazy a) where
91-
show x = "Lazy " `append` show (force x)
95+
show x = "(defer \\_ -> " <> show (force x) <> ")"
9296

9397
instance lazyLazy :: CL.Lazy (Lazy a) where
9498
defer f = defer \_ -> force (f unit)

0 commit comments

Comments
 (0)