aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hypsrc-test/ref/src/Records.html241
-rw-r--r--hypsrc-test/src/Records.hs9
2 files changed, 250 insertions, 0 deletions
diff --git a/hypsrc-test/ref/src/Records.html b/hypsrc-test/ref/src/Records.html
index cdff7eb5..0751782a 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"
+ >-&gt;</span
+ ><span class=""
+ > </span
+ ><span class="hs-identifier hs-type"
+ >Int</span
+ ><span class=""
+ > </span
+ ><span class="hs-glyph"
+ >-&gt;</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"
+ >-&gt;</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 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 }