aboutsummaryrefslogtreecommitdiff
path: root/hypsrc-test
diff options
context:
space:
mode:
authorŁukasz Hanuszczak <lukasz.hanuszczak@gmail.com>2015-06-30 20:10:08 +0200
committerŁukasz Hanuszczak <lukasz.hanuszczak@gmail.com>2015-06-30 22:37:50 +0200
commit95dfb7ab280d69d2bc2eb7f9ab0c4c3deae53cc2 (patch)
tree6f084d49591441992ecd7c36d2c095a9dfa45aba /hypsrc-test
parent15ac1a816a9875591febcf678bbf914a11e5068f (diff)
Add test case for constructor hyperlinking.
Diffstat (limited to 'hypsrc-test')
-rw-r--r--hypsrc-test/src/Constructors.hs27
1 files changed, 27 insertions, 0 deletions
diff --git a/hypsrc-test/src/Constructors.hs b/hypsrc-test/src/Constructors.hs
new file mode 100644
index 00000000..c52bdc72
--- /dev/null
+++ b/hypsrc-test/src/Constructors.hs
@@ -0,0 +1,27 @@
+module Constructors where
+
+
+data Foo
+ = Bar
+ | Baz
+ | Quux Foo Int
+
+newtype Norf = Norf (Foo, [Foo], Foo)
+
+
+bar, baz, quux :: Foo
+bar = Bar
+baz = Baz
+quux = Quux quux 0
+
+
+unfoo :: Foo -> Int
+unfoo Bar = 0
+unfoo Baz = 0
+unfoo (Quux foo n) = 42 * n + unfoo foo
+
+
+unnorf :: Norf -> [Foo]
+unnorf (Norf (Bar, xs, Bar)) = xs
+unnorf (Norf (Baz, xs, Baz)) = reverse xs
+unnorf _ = undefined