[Haskell-cafe] Annotations in abstract syntax tree

Stefan Holdermans stefan at vectorfabrics.com
Fri Apr 27 14:40:54 CEST 2012


Romildo,

> I could write the (Functor ExprF) instance:
> 
>  instance Functor ExprF where
>    fmap f expr = case expr of
>                    Num n -> Num n
>                    Var v -> Var v
>                    Bin op x y -> Bin op (f x) (f y)

Yes, excellent. That'll do.

Cheers,

  Stefan



More information about the Haskell-Cafe mailing list