Skip to content

Instantly share code, notes, and snippets.

@qoelet
Created September 21, 2013 18:30
Show Gist options
  • Save qoelet/6652967 to your computer and use it in GitHub Desktop.
Save qoelet/6652967 to your computer and use it in GitHub Desktop.
-- I finally got sick of reading books on Maybe and IO monads!
-- I spyed beyond that there must be mooarrr!
import Control.Monad.Identity
agent :: (Num a) => a -> Identity a
agent n = do
return n >>= (\n -> Identity (n * 2))
main :: IO ()
main = do
let x = 7
putStrLn ("My double identity is " ++ show(runIdentity (agent x)) ++ "!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment