blob: 5057b8a4382b4dbab15c0f1980231e37b6391509 (
plain) (
tree)
|
|
<html xmlns="http://www.w3.org/1999/xhtml"
><head
><link rel="stylesheet" type="text/css" href="style.css"
/><script type="text/javascript" src="highlight.js"
></script
></head
><body
><pre
><span class="hs-pragma"
>{-# LANGUAGE NamedFieldPuns #-}</span
><span
>
</span
><span id="line-2"
></span
><span class="hs-pragma"
>{-# LANGUAGE RecordWildCards #-}</span
><span
>
</span
><span id="line-3"
></span
><span
>
</span
><span id="line-4"
></span
><span
>
</span
><span id="line-5"
></span
><span class="hs-keyword"
>module</span
><span
> </span
><span class="hs-identifier"
>Records</span
><span
> </span
><span class="hs-keyword"
>where</span
><span
>
</span
><span id="line-6"
></span
><span
>
</span
><span id="line-7"
></span
><span
>
</span
><span id="line-8"
></span
><span class="hs-keyword"
>data</span
><span
> </span
><span id="Point"
><span class="annot"
><a href="Records.html#Point"
><span class="hs-identifier hs-var"
>Point</span
></a
></span
></span
><span
> </span
><span class="hs-glyph"
>=</span
><span
> </span
><span id="Point"
><span class="annot"
><a href="Records.html#Point"
><span class="hs-identifier hs-var"
>Point</span
></a
></span
></span
><span
>
</span
><span id="line-9"
></span
><span
> </span
><span class="hs-special"
>{</span
><span
> </span
><span id="x"
><span class="annot"
><span class="annottext"
>Point -> Int
</span
><a href="Records.html#x"
><span class="hs-identifier hs-var hs-var"
>x</span
></a
></span
></span
><span
> </span
><span class="hs-glyph"
>::</span
><span
> </span
><span class="hs-glyph"
>!</span
><span class="annot"
><span class="hs-identifier hs-type"
>Int</span
></span
><span
>
</span
><span id="line-10"
></span
><span
> </span
><span class="hs-special"
>,</span
><span
> </span
><span id="y"
><span class="annot"
><span class="annottext"
>Point -> Int
</span
><a href="Records.html#y"
><span class="hs-identifier hs-var hs-var"
>y</span
></a
></span
></span
><span
> </span
><span class="hs-glyph"
>::</span
><span
> </span
><span class="hs-glyph"
>!</span
><span class="annot"
><span class="hs-identifier hs-type"
>Int</span
></span
><span
>
</span
><span id="line-11"
></span
><span
> </span
><span class="hs-special"
>}</span
><span
>
</span
><span id="line-12"
></span
><span
>
</span
><span id="line-13"
></span
><span
>
</span
><span id="line-14"
></span
><span class="annot"
><a href="Records.html#point"
><span class="hs-identifier hs-type"
>point</span
></a
></span
><span
> </span
><span class="hs-glyph"
>::</span
><span
> </span
><span class="annot"
><span class="hs-identifier hs-type"
>Int</span
></span
><span
> </span
><span class="hs-glyph"
>-></span
><span
> </span
><span class="annot"
><span class="hs-identifier hs-type"
>Int</span
></span
><span
> </span
><span class="hs-glyph"
>-></span
><span
> </span
><span class="annot"
><a href="Records.html#Point"
><span class="hs-identifier hs-type"
>Point</span
></a
></span
><span
>
</span
><span id="line-15"
></span
><span id="point"
><span class="annot"
><span class="annottext"
>point :: Int -> Int -> Point
</span
><a href="Records.html#point"
><span class="hs-identifier hs-var hs-var"
>point</span
></a
></span
></span
><span
> </span
><span id=""
><span class="annot"
><span class="annottext"
>x :: Int
</span
><a href="#"
><span class="hs-identifier hs-var"
>x</span
></a
></span
></span
><span
> </span
><span id=""
><span class="annot"
><span class="annottext"
>y :: Int
</span
><a href="#"
><span class="hs-identifier hs-var"
>y</span
></a
></span
></span
><span
> </span
><span class="hs-glyph"
>=</span
><span
> </span
><span class="annot"
><span class="annottext"
>$WPoint :: Int -> Int -> Point
</span
><a href="Records.html#%24WPoint"
><span class="hs-identifier hs-type hs-type"
>Point</span
></a
></span
><span
> </span
><span class="hs-special"
>{</span
><span
> </span
><span class="annot"
><span class="annottext"
>x :: Int
</span
><a href="Records.html#x"
><span class="hs-identifier hs-var"
>x</span
></a
></span
><span
> </span
><span class="hs-glyph"
>=</span
><span
> </span
><span class="annot"
><span class="annottext"
>Int
</span
><a href="#"
><span class="hs-identifier hs-var"
>x</span
></a
></span
><span class="hs-special"
>,</span
><span
> </span
><span class="annot"
><span class="annottext"
>y :: Int
</span
><a href="Records.html#y"
><span class="hs-identifier hs-var"
>y</span
></a
></span
><span
> </span
><span class="hs-glyph"
>=</span
><span
> </span
><span class="annot"
><span class="annottext"
>Int
</span
><a href="#"
><span class="hs-identifier hs-var"
>y</span
></a
></span
><span
> </span
><span class="hs-special"
>}</span
><span
>
</span
><span id="line-16"
></span
><span
>
</span
><span id="line-17"
></span
><span
>
</span
><span id="line-18"
></span
><span class="annot"
><a href="Records.html#lengthSqr"
><span class="hs-identifier hs-type"
>lengthSqr</span
></a
></span
><span
> </span
><span class="hs-glyph"
>::</span
><span
> </span
><span class="annot"
><a href="Records.html#Point"
><span class="hs-identifier hs-type"
>Point</span
></a
></span
><span
> </span
><span class="hs-glyph"
>-></span
><span
> </span
><span class="annot"
><span class="hs-identifier hs-type"
>Int</span
></span
><span
>
</span
><span id="line-19"
></span
><span id="lengthSqr"
><span class="annot"
><span class="annottext"
>lengthSqr :: Point -> Int
</span
><a href="Records.html#lengthSqr"
><span class="hs-identifier hs-var hs-var"
>lengthSqr</span
></a
></span
></span
><span
> </span
><span class="hs-special"
>(</span
><span class="annot"
><a href="Records.html#Point"
><span class="hs-identifier hs-type"
>Point</span
></a
></span
><span
> </span
><span class="hs-special"
>{</span
><span
> </span
><span class="annot"
><span class="annottext"
>x :: Point -> Int
</span
><a href="Records.html#x"
><span class="hs-identifier hs-var"
>x</span
></a
></span
><span
> </span
><span class="hs-glyph"
>=</span
><span
> </span
><span id=""
><span class="annot"
><span class="annottext"
>Int
</span
><a href="#"
><span class="hs-identifier hs-var"
>x</span
></a
></span
></span
><span class="hs-special"
>,</span
><span
> </span
><span class="annot"
><span class="annottext"
>y :: Point -> Int
</span
><a href="Records.html#y"
><span class="hs-identifier hs-var"
>y</span
></a
></span
><span
> </span
><span class="hs-glyph"
>=</span
><span
> </span
><span id=""
><span class="annot"
><span class="annottext"
>Int
</span
><a href="#"
><span class="hs-identifier hs-var"
>y</span
></a
></span
></span
><span
> </span
><span class="hs-special"
>}</span
><span class="hs-special"
>)</span
><span
> </span
><span class="hs-glyph"
>=</span
><span
> </span
><span class="annot"
><span class="annottext"
>Int
</span
><a href="#"
><span class="hs-identifier hs-var"
>x</span
></a
></span
><span
> </span
><span class="annot"
><span class="annottext"
>Int -> Int -> Int
forall a. Num a => a -> a -> a
</span
><span class="hs-operator hs-var"
>*</span
></span
><span
> </span
><span class="annot"
><span class="annottext"
>Int
</span
><a href="#"
><span class="hs-identifier hs-var"
>x</span
></a
></span
><span
> </span
><span class="annot"
><span class="annottext"
>Int -> Int -> Int
forall a. Num a => a -> a -> a
</span
><span class="hs-operator hs-var"
>+</span
></span
><span
> </span
><span class="annot"
><span class="annottext"
>Int
</span
><a href="#"
><span class="hs-identifier hs-var"
>y</span
></a
></span
><span
> </span
><span class="annot"
><span class="annottext"
>Int -> Int -> Int
forall a. Num a => a -> a -> a
</span
><span class="hs-operator hs-var"
>*</span
></span
><span
> </span
><span class="annot"
><span class="annottext"
>Int
</span
><a href="#"
><span class="hs-identifier hs-var"
>y</span
></a
></span
><span
>
</span
><span id="line-20"
></span
><span
>
</span
><span id="line-21"
></span
><span class="annot"
><a href="Records.html#lengthSqr%27"
><span class="hs-identifier hs-type"
>lengthSqr'</span
></a
></span
><span
> </span
><span class="hs-glyph"
>::</span
><span
> </span
><span class="annot"
><a href="Records.html#Point"
><span class="hs-identifier hs-type"
>Point</span
></a
></span
><span
> </span
><span class="hs-glyph"
>-></span
><span
> </span
><span class="annot"
><span class="hs-identifier hs-type"
>Int</span
></span
><span
>
</span
><span id="line-22"
></span
><span id="lengthSqr%27"
><span class="annot"
><span class="annottext"
>lengthSqr' :: Point -> Int
</span
><a href="Records.html#lengthSqr%27"
><span class="hs-identifier hs-var hs-var"
>lengthSqr'</span
></a
></span
></span
><span
> </span
><span class="hs-special"
>(</span
><span class="annot"
><a href="Records.html#Point"
><span class="hs-identifier hs-type"
>Point</span
></a
></span
><span
> </span
><span class="hs-special"
>{</span
><span
> </span
><span id=""
><span class="annot"
><span class="annottext"
>Int
x :: Int
x :: Point -> Int
</span
><a href="#"
><span class="hs-identifier hs-var hs-var"
>x</span
></a
></span
></span
><span class="hs-special"
>,</span
><span
> </span
><span id=""
><span class="annot"
><span class="annottext"
>Int
y :: Int
y :: Point -> Int
</span
><a href="#"
><span class="hs-identifier hs-var hs-var"
>y</span
></a
></span
></span
><span
> </span
><span class="hs-special"
>}</span
><span class="hs-special"
>)</span
><span
> </span
><span class="hs-glyph"
>=</span
><span
> </span
><span class="annot"
><span class="annottext"
>Int
</span
><a href="#"
><span class="hs-identifier hs-var"
>y</span
></a
></span
><span
> </span
><span class="annot"
><span class="annottext"
>Int -> Int -> Int
forall a. Num a => a -> a -> a
</span
><span class="hs-operator hs-var"
>*</span
></span
><span
> </span
><span class="annot"
><span class="annottext"
>Int
</span
><a href="#"
><span class="hs-identifier hs-var"
>y</span
></a
></span
><span
> </span
><span class="annot"
><span class="annottext"
>Int -> Int -> Int
forall a. Num a => a -> a -> a
</span
><span class="hs-operator hs-var"
>+</span
></span
><span
> </span
><span class="annot"
><span class="annottext"
>Int
</span
><a href="#"
><span class="hs-identifier hs-var"
>x</span
></a
></span
><span
> </span
><span class="annot"
><span class="annottext"
>Int -> Int -> Int
forall a. Num a => a -> a -> a
</span
><span class="hs-operator hs-var"
>*</span
></span
><span
> </span
><span class="annot"
><span class="annottext"
>Int
</span
><a href="#"
><span class="hs-identifier hs-var"
>x</span
></a
></span
><span
>
</span
><span id="line-23"
></span
><span
>
</span
><span id="line-24"
></span
><span
>
</span
><span id="line-25"
></span
><span class="annot"
><a href="Records.html#translateX"
><span class="hs-identifier hs-type"
>translateX</span
></a
></span
><span class="hs-special"
>,</span
><span
> </span
><span class="annot"
><a href="Records.html#translateY"
><span class="hs-identifier hs-type"
>translateY</span
></a
></span
><span
> </span
><span class="hs-glyph"
>::</span
><span
> </span
><span class="annot"
><a href="Records.html#Point"
><span class="hs-identifier hs-type"
>Point</span
></a
></span
><span
> </span
><span class="hs-glyph"
>-></span
><span
> </span
><span class="annot"
><span class="hs-identifier hs-type"
>Int</span
></span
><span
> </span
><span class="hs-glyph"
>-></span
><span
> </span
><span class="annot"
><a href="Records.html#Point"
><span class="hs-identifier hs-type"
>Point</span
></a
></span
><span
>
</span
><span id="line-26"
></span
><span id="translateX"
><span class="annot"
><span class="annottext"
>translateX :: Point -> Int -> Point
</span
><a href="Records.html#translateX"
><span class="hs-identifier hs-var hs-var"
>translateX</span
></a
></span
></span
><span
> </span
><span id=""
><span class="annot"
><span class="annottext"
>p :: Point
</span
><a href="#"
><span class="hs-identifier hs-var"
>p</span
></a
></span
></span
><span
> </span
><span id=""
><span class="annot"
><span class="annottext"
>d :: Int
</span
><a href="#"
><span class="hs-identifier hs-var"
>d</span
></a
></span
></span
><span
> </span
><span class="hs-glyph"
>=</span
><span
> </span
><span class="annot"
><span class="annottext"
>Point
</span
><a href="#"
><span class="hs-identifier hs-var"
>p</span
></a
></span
><span
> </span
><span class="hs-special"
>{</span
><span
> </span
><span class="annot"
><span class="annottext"
>x :: Int
</span
><a href="Records.html#x"
><span class="hs-identifier hs-var"
>x</span
></a
></span
><span
> </span
><span class="hs-glyph"
>=</span
><span
> </span
><span class="annot"
><span class="annottext"
>Point -> Int
</span
><a href="Records.html#x"
><span class="hs-identifier hs-var hs-var"
>x</span
></a
></span
><span
> </span
><span class="annot"
><span class="annottext"
>Point
</span
><a href="#"
><span class="hs-identifier hs-var"
>p</span
></a
></span
><span
> </span
><span class="annot"
><span class="annottext"
>Int -> Int -> Int
forall a. Num a => a -> a -> a
</span
><span class="hs-operator hs-var"
>+</span
></span
><span
> </span
><span class="annot"
><span class="annottext"
>Int
</span
><a href="#"
><span class="hs-identifier hs-var"
>d</span
></a
></span
><span
> </span
><span class="hs-special"
>}</span
><span
>
</span
><span id="line-27"
></span
><span id="translateY"
><span class="annot"
><span class="annottext"
>translateY :: Point -> Int -> Point
</span
><a href="Records.html#translateY"
><span class="hs-identifier hs-var hs-var"
>translateY</span
></a
></span
></span
><span
> </span
><span id=""
><span class="annot"
><span class="annottext"
>p :: Point
</span
><a href="#"
><span class="hs-identifier hs-var"
>p</span
></a
></span
></span
><span
> </span
><span id=""
><span class="annot"
><span class="annottext"
>d :: Int
</span
><a href="#"
><span class="hs-identifier hs-var"
>d</span
></a
></span
></span
><span
> </span
><span class="hs-glyph"
>=</span
><span
> </span
><span class="annot"
><span class="annottext"
>Point
</span
><a href="#"
><span class="hs-identifier hs-var"
>p</span
></a
></span
><span
> </span
><span class="hs-special"
>{</span
><span
> </span
><span class="annot"
><span class="annottext"
>y :: Int
</span
><a href="Records.html#y"
><span class="hs-identifier hs-var"
>y</span
></a
></span
><span
> </span
><span class="hs-glyph"
>=</span
><span
> </span
><span class="annot"
><span class="annottext"
>Point -> Int
</span
><a href="Records.html#y"
><span class="hs-identifier hs-var hs-var"
>y</span
></a
></span
><span
> </span
><span class="annot"
><span class="annottext"
>Point
</span
><a href="#"
><span class="hs-identifier hs-var"
>p</span
></a
></span
><span
> </span
><span class="annot"
><span class="annottext"
>Int -> Int -> Int
forall a. Num a => a -> a -> a
</span
><span class="hs-operator hs-var"
>+</span
></span
><span
> </span
><span class="annot"
><span class="annottext"
>Int
</span
><a href="#"
><span class="hs-identifier hs-var"
>d</span
></a
></span
><span
> </span
><span class="hs-special"
>}</span
><span
>
</span
><span id="line-28"
></span
><span
>
</span
><span id="line-29"
></span
><span class="annot"
><a href="Records.html#translate"
><span class="hs-identifier hs-type"
>translate</span
></a
></span
><span
> </span
><span class="hs-glyph"
>::</span
><span
> </span
><span class="annot"
><span class="hs-identifier hs-type"
>Int</span
></span
><span
> </span
><span class="hs-glyph"
>-></span
><span
> </span
><span class="annot"
><span class="hs-identifier hs-type"
>Int</span
></span
><span
> </span
><span class="hs-glyph"
>-></span
><span
> </span
><span class="annot"
><a href="Records.html#Point"
><span class="hs-identifier hs-type"
>Point</span
></a
></span
><span
> </span
><span class="hs-glyph"
>-></span
><span
> </span
><span class="annot"
><a href="Records.html#Point"
><span class="hs-identifier hs-type"
>Point</span
></a
></span
><span
>
</span
><span id="line-30"
></span
><span id="translate"
><span class="annot"
><span class="annottext"
>translate :: Int -> Int -> Point -> Point
</span
><a href="Records.html#translate"
><span class="hs-identifier hs-var hs-var"
>translate</span
></a
></span
></span
><span
> </span
><span id=""
><span class="annot"
><span class="annottext"
>x :: Int
</span
><a href="#"
><span class="hs-identifier hs-var"
>x</span
></a
></span
></span
><span
> </span
><span id=""
><span class="annot"
><span class="annottext"
>y :: Int
</span
><a href="#"
><span class="hs-identifier hs-var"
>y</span
></a
></span
></span
><span
> </span
><span id=""
><span class="annot"
><span class="annottext"
>p :: Point
</span
><a href="#"
><span class="hs-identifier hs-var"
>p</span
></a
></span
></span
><span
> </span
><span class="hs-glyph"
>=</span
><span
>
</span
><span id="line-31"
></span
><span
> </span
><span class="annot"
><span class="annottext"
>Point -> Point
</span
><a href="#"
><span class="hs-identifier hs-var"
>aux</span
></a
></span
><span
> </span
><span class="annot"
><span class="annottext"
>Point
</span
><a href="#"
><span class="hs-identifier hs-var"
>p</span
></a
></span
><span
>
</span
><span id="line-32"
></span
><span
> </span
><span class="hs-keyword"
>where</span
><span
>
</span
><span id="line-33"
></span
><span
> </span
><span class="hs-special"
>(</span
><span id=""
><span class="annot"
><span class="annottext"
>dx :: Int
</span
><a href="#"
><span class="hs-identifier hs-var"
>dx</span
></a
></span
></span
><span class="hs-special"
>,</span
><span
> </span
><span id=""
><span class="annot"
><span class="annottext"
>dy :: Int
</span
><a href="#"
><span class="hs-identifier hs-var"
>dy</span
></a
></span
></span
><span class="hs-special"
>)</span
><span
> </span
><span class="hs-glyph"
>=</span
><span
> </span
><span class="hs-special"
>(</span
><span class="annot"
><span class="annottext"
>Int
</span
><a href="#"
><span class="hs-identifier hs-var"
>x</span
></a
></span
><span class="hs-special"
>,</span
><span
> </span
><span class="annot"
><span class="annottext"
>Int
</span
><a href="#"
><span class="hs-identifier hs-var"
>y</span
></a
></span
><span class="hs-special"
>)</span
><span
>
</span
><span id="line-34"
></span
><span
> </span
><span id=""
><span class="annot"
><span class="annottext"
>aux :: Point -> Point
</span
><a href="#"
><span class="hs-identifier hs-var hs-var"
>aux</span
></a
></span
></span
><span
> </span
><span id=""
><span id=""
><span class="annot"
><a href="Records.html#Point"
><span class="hs-identifier hs-type"
>Point</span
></a
></span
><span class="hs-special"
>{</span
><span class="hs-glyph"
>..</span
><span class="hs-special"
>}</span
></span
></span
><span
> </span
><span class="hs-glyph"
>=</span
><span
> </span
><span class="annot"
><span class="annottext"
>Point
</span
><a href="#"
><span class="hs-identifier hs-var"
>p</span
></a
></span
><span
> </span
><span class="hs-special"
>{</span
><span
> </span
><span class="annot"
><span class="annottext"
>x :: Int
</span
><a href="Records.html#x"
><span class="hs-identifier hs-var"
>x</span
></a
></span
><span
> </span
><span class="hs-glyph"
>=</span
><span
> </span
><span class="annot"
><span class="annottext"
>Int
</span
><a href="#"
><span class="hs-identifier hs-var"
>x</span
></a
></span
><span
> </span
><span class="annot"
><span class="annottext"
>Int -> Int -> Int
forall a. Num a => a -> a -> a
</span
><span class="hs-operator hs-var"
>+</span
></span
><span
> </span
><span class="annot"
><span class="annottext"
>Int
</span
><a href="#"
><span class="hs-identifier hs-var"
>dx</span
></a
></span
><span class="hs-special"
>,</span
><span
> </span
><span class="annot"
><span class="annottext"
>y :: Int
</span
><a href="Records.html#y"
><span class="hs-identifier hs-var"
>y</span
></a
></span
><span
> </span
><span class="hs-glyph"
>=</span
><span
> </span
><span class="annot"
><span class="annottext"
>Int
</span
><a href="#"
><span class="hs-identifier hs-var"
>y</span
></a
></span
><span
> </span
><span class="annot"
><span class="annottext"
>Int -> Int -> Int
forall a. Num a => a -> a -> a
</span
><span class="hs-operator hs-var"
>+</span
></span
><span
> </span
><span class="annot"
><span class="annottext"
>Int
</span
><a href="#"
><span class="hs-identifier hs-var"
>dy</span
></a
></span
><span
> </span
><span class="hs-special"
>}</span
><span
>
</span
><span id="line-35"
></span
></pre
></body
></html
>
|