diff options
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 |
commit | d6fcd4692c1d77003ed83c9faf22a2d922dd761f (patch) | |
tree | 33369a48931d4fa5ab5dcb7e99edca496bd5fe6e /hypsrc-test | |
parent | 2b748bb10a40d3787bea35fc24564edac64b11c9 (diff) |
Add record wildcards test for records hyperlinking test case.
Diffstat (limited to 'hypsrc-test')
-rw-r--r-- | hypsrc-test/ref/src/Records.html | 241 | ||||
-rw-r--r-- | hypsrc-test/src/Records.hs | 9 |
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" + >-></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 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 } |