Romildo, > How should an instance of (Functor ExprF) be defined? It is not shown in > the thesis.
It's actually quite straigtforward:
instance Functor ExprF where
fmap _ (Num n) = Num n
fmap _ (Var x) = Var x
fmap f (Bin op l r) = Bin op (f l) (f r)
As expected you get:
> cata exprEval (runExpr (1+2*3))
7.0
HTH,
Stefan
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe
