[Haskell-cafe] derivable type classes

Ivan Lazar Miljenovic ivan.miljenovic at gmail.com
Tue Mar 23 07:05:24 EDT 2010


Ozgur Akgun <ozgurakgun at gmail.com> writes:
> Can a user define a derivable type class of her own?
No.

The derivable classes are defined in the Haskell Report; GHC does allow
some others to be derived with extensions however.

There is one exception to this: using the GeneralizedNewtypeDeriving
extension, if type Foo instantiates a typeclass Baz, then you can derive
Baz for newtype Bar = Bar Foo.
-- 
Ivan Lazar Miljenovic
Ivan.Miljenovic at gmail.com
IvanMiljenovic.wordpress.com


More information about the Haskell-Cafe mailing list