aboutsummaryrefslogtreecommitdiff
path: root/hypsrc-test/src/Records.hs
diff options
context:
space:
mode:
authorŁukasz Hanuszczak <lukasz.hanuszczak@gmail.com>2015-07-01 19:56:27 +0200
committerŁukasz Hanuszczak <lukasz.hanuszczak@gmail.com>2015-07-01 19:56:27 +0200
commitd6fcd4692c1d77003ed83c9faf22a2d922dd761f (patch)
tree33369a48931d4fa5ab5dcb7e99edca496bd5fe6e /hypsrc-test/src/Records.hs
parent2b748bb10a40d3787bea35fc24564edac64b11c9 (diff)
Add record wildcards test for records hyperlinking test case.
Diffstat (limited to 'hypsrc-test/src/Records.hs')
-rw-r--r--hypsrc-test/src/Records.hs9
1 files changed, 9 insertions, 0 deletions
diff --git a/hypsrc-test/src/Records.hs b/hypsrc-test/src/Records.hs
index 4118e296..40a01121 100644
--- a/hypsrc-test/src/Records.hs
+++ b/hypsrc-test/src/Records.hs
@@ -1,4 +1,6 @@
{-# LANGUAGE NamedFieldPuns #-}
+{-# LANGUAGE RecordWildCards #-}
+
module Records where
@@ -23,3 +25,10 @@ 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 }
+
+translate :: Int -> Int -> Point -> Point
+translate x y p =
+ aux p
+ where
+ (dx, dy) = (x, y)
+ aux Point{..} = p { x = x + dx, y = y + dy }