[Haskell] same type multiply implementing a class

Brett Giles gilesb at cpsc.ucalgary.ca
Fri Mar 16 12:04:14 EDT 2007


Note the live version of this on haskell wiki is at:
http://www.haskell.org/haskellwiki/Wrapper_types

The link below is for the old non-editible version of the haskel wiki.
On Thu, 2007-03-15 at 15:34 -0600, Derek Elkins wrote:
> Wolfgang Jeltsch wrote:
> > Am Donnerstag, 15. März 2007 03:23 schrieb Daniel Mahler:
> >> Is there any way for the same type to implement a typeclass multiple ways.
> > 
> > You can wrap the type using newtype, thus creating a new type which can 
> > implement type class methods differently.
> 
> This technique is sometimes known as a typeclass wrapper and is related to 
> wrapper types and combines well with phantom types. See 
> http://www.haskell.org/hawiki/WrapperTypes
> _______________________________________________
> Haskell mailing list
> Haskell at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell



More information about the Haskell mailing list