Last active
December 16, 2015 14:09
-
-
Save yangsu/5446765 to your computer and use it in GitHub Desktop.
Haskell Simple Monad
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
module Main where | |
data Position t = Position t deriving (Show) | |
stagger (Position d) = Position (d + 2) | |
crawl (Position d) = Position (d + 1) | |
rtn x = x | |
x >>== f = f x | |
treasureMap pos = pos >>== | |
stagger >>== | |
stagger >>== | |
crawl >>== | |
rtn |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment