<div dir="ltr"><div>This might be a duplicated message. The first time I posted it I  had not subscribed to haskell cafe.</div><div><br></div><div>Suppose the following data type for encoding Boolean expressions:</div><div><br></div><div>data BExpr  a = BTrue</div><div>              | BFalse</div><div>              | Id String</div><div>              | Not a</div><div>              | And a a</div><div>              | Or  a a</div><div>              | BEq a a</div><div>          deriving (Functor)</div><div>type Expr = Fix BExpr<br></div><div><br></div><div>It is easy to produce a string representation of an expression or evaluate it:</div><div><br></div><div>estr :: BExpr String -> String</div><div>eval :: BExpr Bool  -> Bool</div><div><br></div><div>with the cata function from Data.Functor.Fixedpoint.</div><div><br></div><div>Could you suggest a solution for transforming trees encoded as Exp into equivalent Expr (e.g Not Not a ~> a)?</div><div>cata does not work since it expects a function f a -> a while a transformation would be f a -> f a.</div></div>