projects
/
harpy.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5e6e6cb
)
CodeGenMonad: add Functor instance
master
author
Bernhard Urban
<lewurm@gmail.com>
Sun, 9 Sep 2012 09:59:46 +0000
(11:59 +0200)
committer
Bernhard Urban
<lewurm@gmail.com>
Sun, 9 Sep 2012 09:59:46 +0000
(11:59 +0200)
Harpy/CodeGenMonad.hs
patch
|
blob
|
history
diff --git
a/Harpy/CodeGenMonad.hs
b/Harpy/CodeGenMonad.hs
index c716b70498cd48acacfa37cdb62b12fc8917d07d..94d68a1182977a6ba3823fb9dc030c5c0b69f9cd 100644
(file)
--- a/
Harpy/CodeGenMonad.hs
+++ b/
Harpy/CodeGenMonad.hs
@@
-173,6
+173,9
@@
instance Monad (CodeGen e s) where
fail err = cgFail err
m >>= k = cgBind m k
fail err = cgFail err
m >>= k = cgBind m k
+instance Functor (CodeGen e s) where
+ fmap = liftM
+
cgReturn :: a -> CodeGen e s a
cgReturn x = CodeGen (\_env state -> return (state, Right x))
cgReturn :: a -> CodeGen e s a
cgReturn x = CodeGen (\_env state -> return (state, Right x))