File tree 6 files changed +40
-3
lines changed 6 files changed +40
-3
lines changed Original file line number Diff line number Diff line change @@ -11,9 +11,11 @@ install:
11
11
- chmod a+x $HOME/purescript
12
12
- npm install -g bower
13
13
- npm install
14
- - bower install
15
14
script :
15
+ - bower install --production
16
16
- npm run -s build
17
+ - bower install
18
+ - npm -s test
17
19
after_success :
18
20
- >-
19
21
test $TRAVIS_TAG &&
Original file line number Diff line number Diff line change 18
18
],
19
19
"dependencies" : {
20
20
"purescript-prelude" : " ^3.0.0"
21
+ },
22
+ "devDependencies" : {
23
+ "purescript-eff" : " ^3.1.0"
21
24
}
22
25
}
Original file line number Diff line number Diff line change 2
2
"private" : true ,
3
3
"scripts" : {
4
4
"clean" : " rimraf output && rimraf .pulp-cache" ,
5
- "build" : " pulp build -- --censor-lib --strict"
5
+ "build" : " pulp build -- --censor-lib --strict" ,
6
+ "test" : " pulp test"
6
7
},
7
8
"devDependencies" : {
8
9
"pulp" : " ^10.0.4" ,
Original file line number Diff line number Diff line change 1
1
module Control.Lazy where
2
2
3
- import Data.Unit (Unit )
3
+ import Data.Unit (Unit , unit )
4
4
5
5
-- | The `Lazy` class represents types which allow evaluation of values
6
6
-- | to be _deferred_.
@@ -10,6 +10,9 @@ import Data.Unit (Unit)
10
10
class Lazy l where
11
11
defer :: (Unit -> l ) -> l
12
12
13
+ instance lazyFn :: Lazy (a -> b ) where
14
+ defer f = \x -> f unit x
15
+
13
16
-- | `fix` defines a value as the fixed point of a function.
14
17
-- |
15
18
-- | The `Lazy` instance allows us to generate the result lazily.
Original file line number Diff line number Diff line change
1
+ module Test.Control.Lazy (testLazy ) where
2
+
3
+ import Control.Applicative (pure )
4
+ import Control.Monad.Eff (Eff )
5
+ import Control.Lazy (fix )
6
+ import Data.Unit (Unit , unit )
7
+
8
+ foo :: forall a . a -> Unit
9
+ foo _ = unit
10
+
11
+ foofoo :: forall a b . a -> (b -> Unit )
12
+ foofoo _ = foo
13
+
14
+ foo' :: forall a . a -> Unit
15
+ foo' = fix foofoo
16
+
17
+ -- the idea here is that foo and foo' are the same function
18
+ testLazy :: Eff () Unit
19
+ testLazy = pure (foo' unit)
Original file line number Diff line number Diff line change
1
+ module Test.Main (main ) where
2
+
3
+ import Control.Monad.Eff (Eff )
4
+ import Data.Unit (Unit )
5
+
6
+ import Test.Control.Lazy (testLazy )
7
+
8
+ main :: Eff () Unit
9
+ main = testLazy
You can’t perform that action at this time.
0 commit comments