Difference between revisions of "Phantom type"

From HaskellWiki
Jump to navigation Jump to search
 
m (+cat)
Line 6: Line 6:
   
 
This helps distinguish phantom types.
 
This helps distinguish phantom types.
  +
  +
[[Category:Idioms]]

Revision as of 19:05, 24 January 2006

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

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.