For simple datatypes like this, GHC can derive the Functor implementation for you:
{-# LANGUAGE DeriveFunctor #-}
data ExprF r = ....
deriving (..., Functor)
See http://www.haskell.org/ghc/docs/7.0.4/html/users_guide/deriving.html
-- ryan
Romildo,
Yes, excellent. That'll do.
> 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)
Cheers,
Stefan
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe