[Haskell] same type multiply implementing a class

Derek Elkins derek.a.elkins at gmail.com
Thu Mar 15 17:34:03 EDT 2007


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


More information about the Haskell mailing list