Skip to content

Commit 22ee549

Browse files
authored
Merge pull request #19 from purescript/ps-0.11
Update for PureScript 0.11
2 parents 12e8fb2 + 008e59c commit 22ee549

File tree

8 files changed

+54
-61
lines changed

8 files changed

+54
-61
lines changed

.eslintrc.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"parserOptions": {
3+
"ecmaVersion": 5
4+
},
5+
"extends": "eslint:recommended",
6+
"env": {
7+
"commonjs": true
8+
},
9+
"rules": {
10+
"strict": [2, "global"],
11+
"block-scoped-var": 2,
12+
"consistent-return": 2,
13+
"eqeqeq": [2, "smart"],
14+
"guard-for-in": 2,
15+
"no-caller": 2,
16+
"no-extend-native": 2,
17+
"no-loop-func": 2,
18+
"no-new": 2,
19+
"no-param-reassign": 2,
20+
"no-return-assign": 2,
21+
"no-unused-expressions": 2,
22+
"no-use-before-define": 2,
23+
"radix": [2, "always"],
24+
"indent": [2, 2],
25+
"quotes": [2, "double"],
26+
"semi": [2, "always"]
27+
}
28+
}

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/.*
22
!/.gitignore
3-
!/.jscsrc
4-
!/.jshintrc
3+
!/.eslintrc.json
54
!/.travis.yml
65
/bower_components/
76
/node_modules/

.jscsrc

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

.jshintrc

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

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
language: node_js
22
dist: trusty
33
sudo: required
4-
node_js: 6
4+
node_js: stable
55
env:
66
- PATH=$HOME/purescript:$PATH
77
install:

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
"package.json"
2222
],
2323
"dependencies": {
24-
"purescript-monoid": "^2.0.0"
24+
"purescript-monoid": "^3.0.0"
2525
}
2626
}

package.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22
"private": true,
33
"scripts": {
44
"clean": "rimraf output && rimraf .pulp-cache",
5-
"build": "jshint src && jscs src && pulp build --censor-lib --strict"
5+
"build": "eslint src && pulp build -- --censor-lib --strict"
66
},
77
"devDependencies": {
8-
"jscs": "^2.8.0",
9-
"jshint": "^2.9.1",
10-
"pulp": "^9.0.1",
11-
"purescript-psa": "^0.3.9",
12-
"rimraf": "^2.5.0"
8+
"eslint": "^3.17.1",
9+
"pulp": "^10.0.4",
10+
"purescript-psa": "^0.5.0-rc.1",
11+
"rimraf": "^2.6.1"
1312
}
1413
}

src/Data/Lazy.purs

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import Control.Comonad (class Comonad)
66
import Control.Extend (class Extend)
77
import Control.Lazy as CL
88

9+
import Data.Functor.Invariant (class Invariant, imapF)
910
import Data.HeytingAlgebra (implies, ff, tt)
1011
import Data.Monoid (class Monoid, mempty)
1112

@@ -19,61 +20,64 @@ import Data.Monoid (class Monoid, mempty)
1920
-- | type class instances.
2021
-- |
2122
-- | `Lazy` values can be evaluated by using the `force` function.
22-
foreign import data Lazy :: * -> *
23+
foreign import data Lazy :: Type -> Type
2324

2425
-- | Defer a computation, creating a `Lazy` value.
2526
foreign import defer :: forall a. (Unit -> a) -> Lazy a
2627

2728
-- | Force evaluation of a `Lazy` value.
2829
foreign import force :: forall a. Lazy a -> a
2930

30-
instance semiringLazy :: (Semiring a) => Semiring (Lazy a) where
31+
instance semiringLazy :: Semiring a => Semiring (Lazy a) where
3132
add a b = defer \_ -> force a + force b
3233
zero = defer \_ -> zero
3334
mul a b = defer \_ -> force a * force b
3435
one = defer \_ -> one
3536

36-
instance ringLazy :: (Ring a) => Ring (Lazy a) where
37+
instance ringLazy :: Ring a => Ring (Lazy a) where
3738
sub a b = defer \_ -> force a - force b
3839

39-
instance commutativeRingLazy :: (CommutativeRing a) => CommutativeRing (Lazy a)
40+
instance commutativeRingLazy :: CommutativeRing a => CommutativeRing (Lazy a)
4041

41-
instance euclideanRingLazy :: (EuclideanRing a) => EuclideanRing (Lazy a) where
42+
instance euclideanRingLazy :: EuclideanRing a => EuclideanRing (Lazy a) where
4243
degree = degree <<< force
4344
div a b = defer \_ -> force a / force b
4445
mod a b = defer \_ -> force a `mod` force b
4546

46-
instance fieldLazy :: (Field a) => Field (Lazy a)
47+
instance fieldLazy :: Field a => Field (Lazy a)
4748

48-
instance eqLazy :: (Eq a) => Eq (Lazy a) where
49+
instance eqLazy :: Eq a => Eq (Lazy a) where
4950
eq x y = (force x) == (force y)
5051

51-
instance ordLazy :: (Ord a) => Ord (Lazy a) where
52+
instance ordLazy :: Ord a => Ord (Lazy a) where
5253
compare x y = compare (force x) (force y)
5354

54-
instance boundedLazy :: (Bounded a) => Bounded (Lazy a) where
55+
instance boundedLazy :: Bounded a => Bounded (Lazy a) where
5556
top = defer \_ -> top
5657
bottom = defer \_ -> bottom
5758

58-
instance semigroupLazy :: (Semigroup a) => Semigroup (Lazy a) where
59+
instance semigroupLazy :: Semigroup a => Semigroup (Lazy a) where
5960
append a b = defer \_ -> force a <> force b
6061

61-
instance monoidLazy :: (Monoid a) => Monoid (Lazy a) where
62+
instance monoidLazy :: Monoid a => Monoid (Lazy a) where
6263
mempty = defer \_ -> mempty
6364

64-
instance heytingAlgebraLazy :: (HeytingAlgebra a) => HeytingAlgebra (Lazy a) where
65+
instance heytingAlgebraLazy :: HeytingAlgebra a => HeytingAlgebra (Lazy a) where
6566
ff = defer \_ -> ff
6667
tt = defer \_ -> tt
6768
implies a b = implies <$> a <*> b
6869
conj a b = conj <$> a <*> b
6970
disj a b = disj <$> a <*> b
7071
not a = not <$> a
7172

72-
instance booleanAlgebraLazy :: (BooleanAlgebra a) => BooleanAlgebra (Lazy a)
73+
instance booleanAlgebraLazy :: BooleanAlgebra a => BooleanAlgebra (Lazy a)
7374

7475
instance functorLazy :: Functor Lazy where
7576
map f l = defer \_ -> f (force l)
7677

78+
instance invariantLazy :: Invariant Lazy where
79+
imap = imapF
80+
7781
instance applyLazy :: Apply Lazy where
7882
apply f x = defer \_ -> force f (force x)
7983

@@ -91,7 +95,7 @@ instance extendLazy :: Extend Lazy where
9195
instance comonadLazy :: Comonad Lazy where
9296
extract = force
9397

94-
instance showLazy :: (Show a) => Show (Lazy a) where
98+
instance showLazy :: Show a => Show (Lazy a) where
9599
show x = "(defer \\_ -> " <> show (force x) <> ")"
96100

97101
instance lazyLazy :: CL.Lazy (Lazy a) where

0 commit comments

Comments
 (0)