Sergey Mironov | 10 Sep 19:48 2013

Transforming AST parametrized with type

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?


[1] -

PS sclv suggested to use synthesize from SYB to solve the problem.
Could anyone provide me with example of this method?