[Haskell-cafe] Re: newbie : multi-parameter type classes
Christian Maeder
Christian.Maeder at dfki.de
Fri Aug 24 08:33:06 EDT 2007
Thomas Girod wrote:
> Hi there.
>
> I'm trying to define a generic graph type here and don't understand on
> one error I get. Here I come.
>
> module Graph
> where
>
> class (Eq n, Eq e) => Topo a n e where
> empty :: a
> nodes :: a -> [n]
> edges :: a -> [e]
This does not work without functional dependencies. Try:
class (Eq n, Eq e) => Topo a n e | a -> n e where
HTH Christian
P.S. Integer comes in via defaulting (of 0 or 1)
More information about the Haskell-Cafe
mailing list