-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
trivial Lazy instance for functions (#38)
* trivial Lazy instance for functions * make lazyFn defer actually defer fn call Add tests for this. * relax types in tests
- Loading branch information
1 parent
33bcce0
commit c393ee5
Showing
6 changed files
with
40 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,5 +18,8 @@ | |
], | ||
"dependencies": { | ||
"purescript-prelude": "^3.0.0" | ||
}, | ||
"devDependencies": { | ||
"purescript-eff": "^3.1.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module Test.Control.Lazy (testLazy) where | ||
|
||
import Control.Applicative (pure) | ||
import Control.Monad.Eff (Eff) | ||
import Control.Lazy (fix) | ||
import Data.Unit (Unit, unit) | ||
|
||
foo :: forall a. a -> Unit | ||
foo _ = unit | ||
|
||
foofoo :: forall a b. a -> (b -> Unit) | ||
foofoo _ = foo | ||
|
||
foo' :: forall a. a -> Unit | ||
foo' = fix foofoo | ||
|
||
-- the idea here is that foo and foo' are the same function | ||
testLazy :: Eff () Unit | ||
testLazy = pure (foo' unit) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module Test.Main (main) where | ||
|
||
import Control.Monad.Eff (Eff) | ||
import Data.Unit (Unit) | ||
|
||
import Test.Control.Lazy (testLazy) | ||
|
||
main :: Eff () Unit | ||
main = testLazy |