[Haskell-beginners] Overlapping instances

Brandon Allbery allbery.b at gmail.com
Tue Dec 25 17:05:49 CET 2012


On Tue, Dec 25, 2012 at 10:52 AM, Nathan Hüsken <nathan.huesken at posteo.de>wrote:

> instance B b => A b where
>   doSomething = doMore
>

This doesn't quite do what you think; it matches *all* types, then
afterward applies the context.

Your terminology suggests you're trying to do OOP with typeclasses.  Don't;
they're not OOP, and treating them like they are leads only to grief.

-- 
brandon s allbery kf8nh                               sine nomine associates
allbery.b at gmail.com                                  ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20121225/6f348a16/attachment.htm>


More information about the Beginners mailing list