Personal tools

Type synonym

From HaskellWiki

(Difference between revisions)
Jump to: navigation, search
(initial version)
 
(link to type article)
 
Line 1: Line 1:
A type synonym is a different name for a type. Values of different synonyms of the same type are entirely compatible.
+
A '''type synonym''' is a new name for an existing [[type]].
  +
Values of different synonyms of the same type are entirely compatible.
 
In Haskell you can define a type synonym using <code>type</code>:
 
In Haskell you can define a type synonym using <code>type</code>:
 
<haskell>
 
<haskell>
Line 6: Line 6:
   
 
In C you define a type synonym using <code>typedef</code>.
 
In C you define a type synonym using <code>typedef</code>.
  +
  +
[[Category:Glossary]]

Latest revision as of 07:41, 29 November 2007

A type synonym is a new name for an existing type. Values of different synonyms of the same type are entirely compatible. In Haskell you can define a type synonym using type:

type MyChar = Char

In C you define a type synonym using typedef.