summaryrefslogtreecommitdiff
path: root/snip/snip.hs
blob: 4b7b4616cb23093ea85ed8ff28f8c937af5dd49b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import Control.Monad.Writer 
import Control.Monad.State

-- monad transformers in action
main = print $ 
       runState (
               runWriterT  (
                   get >>= \a -> 
                   tell ["foo"] >> 
                   put (a*a) >> 
                   tell ["bar"] >> 
                   tell [show a]
                   )
               ) 5