Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- ColorTypeEnum.hs
- -- http://www.haskell.org/haskellwiki/Performance/Data_types#Enumerations
- {-# LANGUAGE GeneralizedNewtypeDeriving #-}
- newtype Color = Color Int deriving (Eq,Ord,Enum)
- (red:green:blue:_) = [Color 1 ..]
- colorInt (Color int) = int
- main = putStrLn ("List: " ++ show (map colorInt [red,green,blue,green,red]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement