
25 Apr
2009
25 Apr
'09
5:51 p.m.
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 | jochem@functor.nl GPG: 0xE6FABFAB