Created
March 6, 2012 15:29
-
-
Save folone/1986803 to your computer and use it in GitHub Desktop.
Illustration to The Monad Reader issue 17, The Reader Monad and Abstraction Elimination by Petr Pudlak
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
| import Control.Applicative | |
| main = print $ answer succ 0 where | |
| one = pure <*> (pure :: a -> b -> a) | |
| inc = (<*>) ((<*>) <$> pure) | |
| mul = (<*>) <$> pure | |
| h = mul <*> inc | |
| answer = h . h . h $ one |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment