[commit: haddock] master: Add record wildcards test for records hyperlinking test case. (d6fcd46)

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


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

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

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

commit d6fcd4692c1d77003ed83c9faf22a2d922dd761f
Author: Łukasz Hanuszczak <lukasz.hanuszczak at gmail.com>
Date:   Wed Jul 1 19:56:27 2015 +0200

    Add record wildcards test for records hyperlinking test case.


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

d6fcd4692c1d77003ed83c9faf22a2d922dd761f
 hypsrc-test/ref/src/Records.html | 241 +++++++++++++++++++++++++++++++++++++++
 hypsrc-test/src/Records.hs       |   9 ++
 2 files changed, 250 insertions(+)

diff --git a/hypsrc-test/ref/src/Records.html b/hypsrc-test/ref/src/Records.html
index cdff7eb..0751782 100644
--- a/hypsrc-test/ref/src/Records.html
+++ b/hypsrc-test/ref/src/Records.html
@@ -11,6 +11,12 @@
       >{-# LANGUAGE NamedFieldPuns #-}</span
       ><span class=""
       >
+</span
+      ><span class="hs-pragma"
+      >{-# LANGUAGE RecordWildCards #-}</span
+      ><span class=""
+      >
+
 
 </span
       ><span class="hs-keyword"
@@ -639,6 +645,241 @@
       >}</span
       ><span class=""
       >
+
+</span
+      ><span class="hs-identifier"
+      >translate</span
+      ><span class=""
+      > </span
+      ><span class="hs-glyph"
+      >::</span
+      ><span class=""
+      > </span
+      ><span class="hs-identifier hs-type"
+      >Int</span
+      ><span class=""
+      > </span
+      ><span class="hs-glyph"
+      >-></span
+      ><span class=""
+      > </span
+      ><span class="hs-identifier hs-type"
+      >Int</span
+      ><span class=""
+      > </span
+      ><span class="hs-glyph"
+      >-></span
+      ><span class=""
+      > </span
+      ><a href="Records.html#Point"
+      ><span class="hs-identifier hs-type"
+	>Point</span
+	></a
+      ><span class=""
+      > </span
+      ><span class="hs-glyph"
+      >-></span
+      ><span class=""
+      > </span
+      ><a href="Records.html#Point"
+      ><span class="hs-identifier hs-type"
+	>Point</span
+	></a
+      ><span class=""
+      >
+</span
+      ><a name="translate"
+      ><a href="Records.html#translate"
+	><span class="hs-identifier"
+	  >translate</span
+	  ></a
+	></a
+      ><span class=""
+      > </span
+      ><a name="local-0"
+      ><a href="#local-0"
+	><span class="hs-identifier"
+	  >x</span
+	  ></a
+	></a
+      ><span class=""
+      > </span
+      ><a name="local-0"
+      ><a href="#local-0"
+	><span class="hs-identifier"
+	  >y</span
+	  ></a
+	></a
+      ><span class=""
+      > </span
+      ><a name="local-0"
+      ><a href="#local-0"
+	><span class="hs-identifier"
+	  >p</span
+	  ></a
+	></a
+      ><span class=""
+      > </span
+      ><span class="hs-glyph"
+      >=</span
+      ><span class=""
+      >
+    </span
+      ><a href="#local-0"
+      ><span class="hs-identifier hs-var"
+	>aux</span
+	></a
+      ><span class=""
+      > </span
+      ><a href="#local-0"
+      ><span class="hs-identifier hs-var"
+	>p</span
+	></a
+      ><span class=""
+      >
+  </span
+      ><span class="hs-keyword"
+      >where</span
+      ><span class=""
+      >
+    </span
+      ><span class="hs-special"
+      >(</span
+      ><a name="local-0"
+      ><a href="#local-0"
+	><span class="hs-identifier"
+	  >dx</span
+	  ></a
+	></a
+      ><span class="hs-special"
+      >,</span
+      ><span class=""
+      > </span
+      ><a name="local-0"
+      ><a href="#local-0"
+	><span class="hs-identifier"
+	  >dy</span
+	  ></a
+	></a
+      ><span class="hs-special"
+      >)</span
+      ><span class=""
+      > </span
+      ><span class="hs-glyph"
+      >=</span
+      ><span class=""
+      > </span
+      ><span class="hs-special"
+      >(</span
+      ><a href="#local-0"
+      ><span class="hs-identifier hs-var"
+	>x</span
+	></a
+      ><span class="hs-special"
+      >,</span
+      ><span class=""
+      > </span
+      ><a href="#local-0"
+      ><span class="hs-identifier hs-var"
+	>y</span
+	></a
+      ><span class="hs-special"
+      >)</span
+      ><span class=""
+      >
+    </span
+      ><a name="local-0"
+      ><a href="#local-0"
+	><span class="hs-identifier"
+	  >aux</span
+	  ></a
+	></a
+      ><span class=""
+      > </span
+      ><a href="Records.html#Point"
+      ><span class="hs-identifier hs-var"
+	>Point</span
+	></a
+      ><span class="hs-special"
+      >{</span
+      ><span class="hs-glyph"
+      >..</span
+      ><span class="hs-special"
+      >}</span
+      ><span class=""
+      > </span
+      ><span class="hs-glyph"
+      >=</span
+      ><span class=""
+      > </span
+      ><a href="#local-0"
+      ><span class="hs-identifier hs-var"
+	>p</span
+	></a
+      ><span class=""
+      > </span
+      ><span class="hs-special"
+      >{</span
+      ><span class=""
+      > </span
+      ><a href="Records.html#x"
+      ><span class="hs-identifier hs-var"
+	>x</span
+	></a
+      ><span class=""
+      > </span
+      ><span class="hs-glyph"
+      >=</span
+      ><span class=""
+      > </span
+      ><a href="#local-0"
+      ><span class="hs-identifier hs-var"
+	>x</span
+	></a
+      ><span class=""
+      > </span
+      ><span class="hs-operator hs-var"
+      >+</span
+      ><span class=""
+      > </span
+      ><a href="#local-0"
+      ><span class="hs-identifier hs-var"
+	>dx</span
+	></a
+      ><span class="hs-special"
+      >,</span
+      ><span class=""
+      > </span
+      ><a href="Records.html#y"
+      ><span class="hs-identifier hs-var"
+	>y</span
+	></a
+      ><span class=""
+      > </span
+      ><span class="hs-glyph"
+      >=</span
+      ><span class=""
+      > </span
+      ><a href="#local-0"
+      ><span class="hs-identifier hs-var"
+	>y</span
+	></a
+      ><span class=""
+      > </span
+      ><span class="hs-operator hs-var"
+      >+</span
+      ><span class=""
+      > </span
+      ><a href="#local-0"
+      ><span class="hs-identifier hs-var"
+	>dy</span
+	></a
+      ><span class=""
+      > </span
+      ><span class="hs-special"
+      >}</span
+      ><span class=""
+      >
 </span
       ></pre
     ></body
diff --git a/hypsrc-test/src/Records.hs b/hypsrc-test/src/Records.hs
index 4118e29..40a0112 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 }



More information about the ghc-commits mailing list