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
will work.

If you want you can define
(&) = (:&)
and use the & symbol for constructing graphs (not in pattern matches
though).

HTH,

-- 
Jochem Berndsen | joc...@functor.nl
GPG: 0xE6FABFAB
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to