[Haskell-cafe] Factoring into type classes

Jonathan Cast jonathanccast at fastmail.fm
Mon Jan 19 14:06:26 EST 2009


On Mon, 2009-01-19 at 10:59 -0800, Iavor Diatchki wrote:
> Hello,
> The multitude of newtypes in the Monoid module are a good indication
> that the Monoid class is not a good fit for the class system

I would say rather that the class system is not a good fit for Monoid.
Proposals for local instances, multiple instances, instance
import/export control, etc. come up quite frequently on this list; the
phenomena in question are not restricted to Monoid.

> I usually
> avoid using the "newtype" trick as I find it inconvenient:  usually
> the newtype does not have the same operations as the underlying type
> and so it cannot be used directly, and if you are going to wrap thing
> just when you use the class methods,

OTOH, I think you mean here `when you use class methods and when you use
overloaded functions'.

jcc




More information about the Haskell-Cafe mailing list