I think what we're running into is a slight mismatch between a natural understanding of types-as-sets and types-as-ADTs. In the former sense - particularly about things we're used to thinking of as sets (say, Integer) - we want to be able to say "this is still integers, we just want to couple them with this operation and get a monoid here, and that operation and get a different monoid over there, but the objects are all still integers". Viewed as ADTs, it's more intuitive to say "there is some data here behind this interface, and the combination yields a single type", and that's what we're doing with typeclasses in Haskell. I don't *think* there is actually a need to express the former more directly, and I'm not convinced there's a way to do it that's actually cleaner, but I think that's the origin of the impulse (and I don't think the impulse itself is "wrong" - you just need to remember the translation).
Sure... but now you have to make sure everything agrees about it. The way you do this in Haskell is to give your custom instance a distinct type to go with it. (Now go look at the Sum and Product monoids).
--brandon s allbery kf8nh sine nomine associatesunix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe