[Haskell-cafe] parse error on input `&'
jochem at functor.nl
Sat Apr 25 13:51:36 EDT 2009
siso dagbovie wrote:
> I've defined the following datatype with haskell
> data Graph a b = Empty | Context a b & Graph a b
> But I am having the error message: " parse error on input `&' ".
> I am wondering what it is wrong with my definition. How can I fix this?
Constructors have to start with a capital or a : (colon).
So changing your definition into
data Graph a b = Empty | Context a b :& Graph a b
If you want you can define
(&) = (:&)
and use the & symbol for constructing graphs (not in pattern matches
Jochem Berndsen | jochem at functor.nl
More information about the Haskell-Cafe