Created
December 4, 2013 15:54
-
-
Save SimonRichardson/7789972 to your computer and use it in GitHub Desktop.
Chain effects. Is there a way to represent the .chain.chain.chain scenario some like the do notation? Does the do notation already work with this?
This file contains hidden or 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
| var M = State.StateT(IO), | |
| program = M.lift(init) | |
| .chain(doSomething) | |
| .chain(doSomethingElse) | |
| .chain(doSomethingWicked); | |
| console.log(program.exec([]).unsafePerform()); | |
| /* | |
| // What I would like to happen | |
| var M = State.StateT(IO), | |
| program = $do { | |
| a = M.lift(init); | |
| b -> doSomething; | |
| c -> doSomethingElse; | |
| d -> doSomethingWicked; | |
| return d; | |
| }; | |
| console.log(program.exec([]).unsafePerform()); | |
| */ | |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Question is there anything that sort of does something like what I want i.e. hide the chain call in haskell or similar?