[Haskell-cafe] MPTC inheritance
lennart at augustsson.net
Tue Feb 24 14:00:35 EST 2009
There's nothing wrong with the definition of FooGraph. That's how you do it.
On Tue, Feb 24, 2009 at 6:09 PM, Derek Gladding <derek at solidmath.com> wrote:
> Please forgive me if I'm still mentally contaminated by the OO way of seeing
> (and discussing) the universe, but I'm trying to figure out how to "inherit
> an interface" from a multi-parameter type class.
> I have a Graph class that's parameterisable by Node and Edge type:
> class (Node a, Edge b) => Graph a b where
> (lots of stuff that you can do with Graph a b)
> Now, I'd like to build a FooGraph on top of this that adds additional
> class (Graph a b) => FooGraph a b where
> (lots of additional stuff)
> but this isn't allowed (kind mismatch).
> Of couse, I can do:
> class (Node a, Edge b) => FooGraph a b
> but this means that I have to manually replicate the Graph a b operations in
> the FooGraph a b class definition, which is (a) work that the machine should
> (?) be able to do for me, and (b) fragile.
> Any pointers / wisdom would be very much appreciated.
> - Derek
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
More information about the Haskell-Cafe