[Haskell-cafe] Transforming AST parametrized with type
Sergey Mironov
grrwlf at gmail.com
Tue Sep 10 19:48:33 CEST 2013
Hi. Pat asked a question [1] about AST parametrized with types. People
suggest to use Functor machinery if possible. Have anything changed
since them? Do we have a way to safely transform the tree like
data Expr a = Id { id :: Id a } | Op { op :: Char, expra :: (Expr a) ,
exprb :: (Expr a) }
data Id a = Id { name :: a }
from Expr String to, say, Expr Int where Int names may represent some
keys in the hash map?
Regards,
Sergey
[1] - http://stackoverflow.com/questions/5434889/is-it-possible-to-use-syb-to-transform-the-type
PS sclv suggested to use synthesize from SYB to solve the problem.
Could anyone provide me with example of this method?
More information about the Haskell-Cafe
mailing list