summaryrefslogtreecommitdiffstats
path: root/ch03_BogusPattern.hs
diff options
context:
space:
mode:
Diffstat (limited to 'ch03_BogusPattern.hs')
-rw-r--r--ch03_BogusPattern.hs9
1 files changed, 9 insertions, 0 deletions
diff --git a/ch03_BogusPattern.hs b/ch03_BogusPattern.hs
new file mode 100644
index 0000000..34288d3
--- /dev/null
+++ b/ch03_BogusPattern.hs
@@ -0,0 +1,9 @@
+data Fruit = Apple | Orange
+ deriving Show
+
+whichFruit f = case f of
+ "apple" -> Just Apple
+ "orange" -> Just Orange
+ _ -> Nothing
+
+