Skip to content

Building TranslateH and RewriteH

andygill edited this page Jun 16, 2012 · 1 revision

Remember

type RewriteH a = TranslateH a a

Now, there are a number of ways of building TranslateH and RewriteH.

translate :: (HermitEnv -> a -> HermitM b) -> TranslateH a b
contextfreeT :: (a -> HermitM b) -> TranslateH a b
arr :: (a -> b) -> TranslateH a b
constT :: m b -> TranslateH a b
return :: b -> TranslateH a b

Of the above, translate is the most general, and the rest are specialised cases (with return being the most specialised). There are also:

rewrite :: (c -> a -> m a) -> Rewrite c m a a
idR :: Translate c m a a
exposeT :: Translate c m a (c, a)
Clone this wiki locally