From d6fcd4692c1d77003ed83c9faf22a2d922dd761f Mon Sep 17 00:00:00 2001 From: Ɓukasz Hanuszczak Date: Wed, 1 Jul 2015 19:56:27 +0200 Subject: Add record wildcards test for records hyperlinking test case. --- hypsrc-test/src/Records.hs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'hypsrc-test/src') 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 } -- cgit v1.2.3