aboutsummaryrefslogtreecommitdiff
path: root/hypsrc-test/src
diff options
context:
space:
mode:
authorŁukasz Hanuszczak <lukasz.hanuszczak@gmail.com>2015-06-30 20:18:42 +0200
committerŁukasz Hanuszczak <lukasz.hanuszczak@gmail.com>2015-06-30 22:37:50 +0200
commit354d3296371099bad2729cf7b5445d23a107c6c5 (patch)
treeb1a3f472cb6cbe8f710c94471d22bbf2e726e91b /hypsrc-test/src
parent95dfb7ab280d69d2bc2eb7f9ab0c4c3deae53cc2 (diff)
Add test case for record expressions and patterns hyperlinking.
Diffstat (limited to 'hypsrc-test/src')
-rw-r--r--hypsrc-test/src/Records.hs25
1 files changed, 25 insertions, 0 deletions
diff --git a/hypsrc-test/src/Records.hs b/hypsrc-test/src/Records.hs
new file mode 100644
index 00000000..4118e296
--- /dev/null
+++ b/hypsrc-test/src/Records.hs
@@ -0,0 +1,25 @@
+{-# LANGUAGE NamedFieldPuns #-}
+
+module Records where
+
+
+data Point = Point
+ { x :: !Int
+ , y :: !Int
+ }
+
+
+point :: Int -> Int -> Point
+point x y = Point { x = x, y = y }
+
+
+lengthSqr :: Point -> Int
+lengthSqr (Point { x = x, y = y }) = x * x + y * y
+
+lengthSqr' :: Point -> Int
+lengthSqr' (Point { x, y }) = y * y + x * x
+
+
+translateX, translateY :: Point -> Int -> Point
+translateX p d = p { x = x p + d }
+translateY p d = p { y = y p + d }