WrapperTypes are usually trivial wrappers (i.e. newtypes) that
are designed to convey some information to the type system. Non-
trivial type synonyms and Type class wrapper are both instances
of this. This idiom is also in a synergistic relation to Phantom
types, Traits type class, and Simulating dependent types. 1
Usages and examples One use of Wrapper types is to add Phantom
types to a pre-existing (e.g. 3rd party) type.Another example
occurs in WxHaskell to handle interfacing to an OO library. The
Sub-typing relationship is represented as nested wrapper types,
so that Traits type class and wrapper types often give two
different approaches to solving the same problem. For example,
if you want to compare two Strings for equality in different
ways (mainly case-sensitive and case-insensitive) you can either
use a wrapper to adapt String to the Eq class, newtype CIString
= CIString String instance Eq CIString where CIString a ==
CIString b = map toUpper a == map toUpper b or you can make a
TraitsTypeclass class