Hacker News new | ask | show | jobs
by damncabbage 4361 days ago
I think there may be a typo with the first example:

  newtype ID a = ID Int deriving (Eq,Ord,Show)
Should possibly just be:

  newtype ID a = ID a deriving (Eq,Ord,Show)
2 comments

Nah, it is a type of numeric ID's for different types of things. The parameter 'a' is just a phantom type parameter to keep you from mixing up a mesh ID with a texture ID.
This is an example of a 'phantom type'. See http://www.haskell.org/haskellwiki/Phantom_type (and references therein) for an explanation (including a motivation) of this technique.