summaryrefslogtreecommitdiff
path: root/snip
diff options
context:
space:
mode:
authorMiguel <m.i@gmx.at>2019-03-17 18:09:11 +0100
committerMiguel <m.i@gmx.at>2019-03-17 18:09:11 +0100
commit4b192701b6c9ff1ff49405132e2580438b644d27 (patch)
tree175f9ef4d093594fb35744c2bf5bb3d1bfa2c471 /snip
parentdd2f9f78760a81ca68658f49663635ef9e128fd5 (diff)
snipets clean
Diffstat (limited to 'snip')
-rw-r--r--snip/snip.hs14
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