summaryrefslogtreecommitdiffstats
path: root/ch03_BogusPattern.hs
blob: 34288d3796e94aa65eb0214c521efb10a17a6ebf (plain)
1
2
3
4
5
6
7
8
9
data Fruit = Apple | Orange
             deriving Show

whichFruit f = case f of
    "apple" -> Just Apple
    "orange" -> Just Orange
    _       -> Nothing