[commit: haddock] master: Add test case for record expressions and patterns hyperlinking. (354d329)

git at git.haskell.org git at git.haskell.org
Wed Jul 8 08:41:41 UTC 2015


Repository : ssh://git@git.haskell.org/haddock

On branch  : master
Link       : http://git.haskell.org/haddock.git/commitdiff/354d3296371099bad2729cf7b5445d23a107c6c5

>---------------------------------------------------------------

commit 354d3296371099bad2729cf7b5445d23a107c6c5
Author: Łukasz Hanuszczak <lukasz.hanuszczak at gmail.com>
Date:   Tue Jun 30 20:18:42 2015 +0200

    Add test case for record expressions and patterns hyperlinking.


>---------------------------------------------------------------

354d3296371099bad2729cf7b5445d23a107c6c5
 hypsrc-test/src/Records.hs | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/hypsrc-test/src/Records.hs b/hypsrc-test/src/Records.hs
new file mode 100644
index 0000000..4118e29
--- /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 }



More information about the ghc-commits mailing list