diff options
Diffstat (limited to 'snip/snip.hs')
| -rw-r--r-- | snip/snip.hs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/snip/snip.hs b/snip/snip.hs index 532329f..4b7b461 100644 --- a/snip/snip.hs +++ b/snip/snip.hs @@ -1,2 +1,14 @@ +import Control.Monad.Writer +import Control.Monad.State + -- monad transformers in action -Main Control.Monad.Writer Control.Monad.State> runState (runWriterT (get >>= \a -> tell ["foo"] >> put (a*a) >> tell ["bar"] >> tell [show a])) 5 +main = print $ + runState ( + runWriterT ( + get >>= \a -> + tell ["foo"] >> + put (a*a) >> + tell ["bar"] >> + tell [show a] + ) + ) 5 |
