Created January 18, 2014 16:51
-
-
Save DeTeam/8493059 to your computer and use it in GitHub Desktop.
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
| module Main where | |
| import Control.Monad.State.Lazy | |
| import Control.Applicative ((<$>), (<*>)) | |
| myInc = state (\n -> (n, n * n)) | |
| myState = (,) <$> myInc <*> myInc | |
| main = print $ computeState | |
| where computeState = evalState myState 10 |
Author
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
What's the output? :)