Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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)


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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: