Personal tools

Phantom type

From HaskellWiki

Revision as of 20:37, 1 February 2006 by Ashley Y (Talk | contribs)

Jump to: navigation, search

A phantom type is a type the values of which are never used, the type being used only to construct other types. They are used in type arithmetic.

An extension to Haskell 98 supported by GHC allows you to define datatypes without any constructors (and therefore no values other than bottom):

data MyType

This helps distinguish phantom types.