File tree Expand file tree Collapse file tree 6 files changed +40
-3
lines changed
Expand file tree Collapse file tree 6 files changed +40
-3
lines changed Original file line number Diff line number Diff line change @@ -11,9 +11,11 @@ install:
1111 - chmod a+x $HOME/purescript
1212 - npm install -g bower
1313 - npm install
14- - bower install
1514script :
15+ - bower install --production
1616 - npm run -s build
17+ - bower install
18+ - npm -s test
1719after_success :
1820- >-
1921 test $TRAVIS_TAG &&
Original file line number Diff line number Diff line change 1818 ],
1919 "dependencies" : {
2020 "purescript-prelude" : " ^3.0.0"
21+ },
22+ "devDependencies" : {
23+ "purescript-eff" : " ^3.1.0"
2124 }
2225}
Original file line number Diff line number Diff line change 22 "private" : true ,
33 "scripts" : {
44 "clean" : " rimraf output && rimraf .pulp-cache" ,
5- "build" : " pulp build -- --censor-lib --strict"
5+ "build" : " pulp build -- --censor-lib --strict" ,
6+ "test" : " pulp test"
67 },
78 "devDependencies" : {
89 "pulp" : " ^10.0.4" ,
Original file line number Diff line number Diff line change 11module Control.Lazy where
22
3- import Data.Unit (Unit )
3+ import Data.Unit (Unit , unit )
44
55-- | The `Lazy` class represents types which allow evaluation of values
66-- | to be _deferred_.
@@ -10,6 +10,9 @@ import Data.Unit (Unit)
1010class Lazy l where
1111 defer :: (Unit -> l ) -> l
1212
13+ instance lazyFn :: Lazy (a -> b ) where
14+ defer f = \x -> f unit x
15+
1316-- | `fix` defines a value as the fixed point of a function.
1417-- |
1518-- | 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