From 40d0a050c81ff21949fc7eeede4e0dbb3b1d7c98 Mon Sep 17 00:00:00 2001 From: Łukasz Hanuszczak Date: Tue, 30 Jun 2015 22:29:34 +0200 Subject: Add reference files for hyperlinker test cases. --- hypsrc-test/ref/src/Constructors.html | 536 ++++++++++++++++++++++++++++++++++ 1 file changed, 536 insertions(+) create mode 100644 hypsrc-test/ref/src/Constructors.html (limited to 'hypsrc-test/ref/src/Constructors.html') diff --git a/hypsrc-test/ref/src/Constructors.html b/hypsrc-test/ref/src/Constructors.html new file mode 100644 index 00000000..713a85f0 --- /dev/null +++ b/hypsrc-test/ref/src/Constructors.html @@ -0,0 +1,536 @@ + +
module Constructors where
+
+
+data Foo
+    = Bar
+    | Baz
+    | Quux Foo Int
+
+newtype Norf = Norf (Foo, [Foo], Foo)
+
+
+bar, baz, quux :: Foo
+bar = Bar
+baz = Baz
+quux = Quux quux 0
+
+
+unfoo :: Foo -> Int
+unfoo Bar = 0
+unfoo Baz = 0
+unfoo (Quux foo n) = 42 * n + unfoo foo
+
+
+unnorf :: Norf -> [Foo]
+unnorf (Norf (Bar, xs, Bar)) = xs
+unnorf (Norf (Baz, xs, Baz)) = reverse xs
+unnorf _ = undefined
+
-- cgit v1.2.3 From db51ad0a5b2b29749f69fd82513adeedc8729735 Mon Sep 17 00:00:00 2001 From: Łukasz Hanuszczak Date: Wed, 1 Jul 2015 01:16:41 +0200 Subject: Re-accept hyperlinker test cases with local references stripped out. --- hypsrc-test/ref/src/Constructors.html | 24 +++---- hypsrc-test/ref/src/Identifiers.html | 118 +++++++++++++++++----------------- hypsrc-test/ref/src/Literals.html | 10 +-- hypsrc-test/ref/src/Operators.html | 104 +++++++++++++++--------------- hypsrc-test/ref/src/Records.html | 64 +++++++++--------- 5 files changed, 160 insertions(+), 160 deletions(-) (limited to 'hypsrc-test/ref/src/Constructors.html') diff --git a/hypsrc-test/ref/src/Constructors.html b/hypsrc-test/ref/src/Constructors.html index 713a85f0..6d6c7c06 100644 --- a/hypsrc-test/ref/src/Constructors.html +++ b/hypsrc-test/ref/src/Constructors.html @@ -315,16 +315,16 @@ > foo n* n foo, xs= xs, xsreverse xs x y= x+ x y x* y+ y x y= y+ x x y- x+ y x y= x* y* y* y* x x x x x x x y z| x x| y y| z z(-x(-y(-z x y z x y zNum a=> aFractional a=> a[[a [a [a [a a b= a++ b++ a [a [a [a a b= b a [a [a [a) a= a) a_:b= a (a b[[a [a [a a b b) a[[a[[a[[a a b [a b (a b x y= x= y= x= y= x* x+ y* y= y* y+ x* x p d= p p+ d p d= p p+ d Date: Wed, 1 Jul 2015 18:33:44 +0200 Subject: Create test case for hyperlinking @-patterns. --- hypsrc-test/ref/src/Constructors.html | 298 ++++++++++++++++++++++++++++++++++ hypsrc-test/src/Constructors.hs | 8 + 2 files changed, 306 insertions(+) (limited to 'hypsrc-test/ref/src/Constructors.html') diff --git a/hypsrc-test/ref/src/Constructors.html b/hypsrc-test/ref/src/Constructors.html index 6d6c7c06..96be3627 100644 --- a/hypsrc-test/ref/src/Constructors.html +++ b/hypsrc-test/ref/src/Constructors.html @@ -529,6 +529,304 @@ >undefined + + +unnorf' :: Norf -> Int +unnorf' x@(Norf (f1@(Quux _ n), _, f2@(Quux f3 _))) = + x' + n * unfoo f1 + aux f3 + where + aux fx = unfoo f2 * unfoo fx * unfoo f3 + x' = sum . map unfoo . unnorf $ x [Foo] unnorf (Norf (Bar, xs, Bar)) = xs unnorf (Norf (Baz, xs, Baz)) = reverse xs unnorf _ = undefined + + +unnorf' :: Norf -> Int +unnorf' x@(Norf (f1@(Quux _ n), _, f2@(Quux f3 _))) = + x' + n * unfoo f1 + aux f3 + where + aux fx = unfoo f2 * unfoo fx * unfoo f3 + x' = sum . map unfoo . unnorf $ x -- cgit v1.2.3 From 7eafa83ffaf535ae8c1a038f004a254192d08afc Mon Sep 17 00:00:00 2001 From: Łukasz Hanuszczak Date: Sat, 25 Jul 2015 20:08:46 +0200 Subject: Re-accept test cases after adding line anchors for each of them. --- hypsrc-test/ref/src/Classes.html | 498 +++++++++++++++++++++------------- hypsrc-test/ref/src/Constructors.html | 402 +++++++++++++++++---------- hypsrc-test/ref/src/Identifiers.html | 422 ++++++++++++++++------------ hypsrc-test/ref/src/Literals.html | 172 +++++++----- hypsrc-test/ref/src/Operators.html | 288 ++++++++++++-------- hypsrc-test/ref/src/Records.html | 448 ++++++++++++++++++------------ hypsrc-test/ref/src/Types.html | 454 +++++++++++++++++++------------ 7 files changed, 1673 insertions(+), 1011 deletions(-) (limited to 'hypsrc-test/ref/src/Constructors.html') diff --git a/hypsrc-test/ref/src/Classes.html b/hypsrc-test/ref/src/Classes.html index 13c8389a..74a7a427 100644 --- a/hypsrc-test/ref/src/Classes.html +++ b/hypsrc-test/ref/src/Classes.html @@ -9,22 +9,32 @@ >
module Classes where
-
-
 
+
+class Foo a where
-        bar :: a -> Int
-        baz :: Int -> (, )
-
 
+instance Foo Int where
-        bar = id
-        baz x = (, )
-
 
+instance Foo [] where
-        bar = length
-        baz _ = (], [])
+
-
-
 
+class Foo a => Foo' a where
-        quux :: (, ) -> a
-        quux (, ) = norf [, ]
-
-    
+    norf :: [] -> a
-        norf = quux . baz . sum . map bar
+
-
 instance Foo' Int where
-        norf = sum
+
-
 instance Foo' [] where
-        quux = uncurry (++)
+
+
-
-
 class Plugh p where
-        plugh :: p a a -> p b b -> p (a -> ) (b -> )
+
-
 instance Plugh Either where
-        plugh (Left ) _ = Right $ const a
-        plugh (Right ) _ = Right $ const a
-        plugh _ (Left ) = Left $ const b
-        plugh _ (Right ) = Left $ const b
 
module Constructors where
-
-
 
+
+data Foo
-        = Bar
-        | Baz
-        | Quux Foo Int
-
 
+newtype Norf = Norf (, [], )
+
-
-
 
+bar, baz, quux :: Foo
 bar = Bar
 baz = Baz
 quux = Quux quux 0
+
-
-
 
+unfoo :: Foo -> Int
 unfoo Bar = 0
 unfoo Baz = 0
 unfoo (Quux foo ) = 42 * n + unfoo foo
+
-
-
 
+unnorf :: Norf -> []
 unnorf (Norf (, , )) = xs
 unnorf (Norf (, , )) = reverse xs
 unnorf _ = undefined
+
+
-
-
 unnorf' :: Norf -> Int
 unnorf' Norf (Quux _ ), _, Quux f3 _)) =
-        x' + n * unfoo f1 + aux f3
-    where
-        aux fx = unfoo f2 * unfoo fx * unfoo f3
-        x' = sum . map unfoo . unnorf $ x
 
module Identifiers where
-
-
 
+
+foo, bar, baz :: Int -> Int -> Int
 foo x y = x + x * bar y x * y + y
 bar x y = y + x - baz x y - x + y
 baz x y = x * y * y * y * x
+
-
 quux :: Int -> Int
 quux x = foo (bar x ) (bar x )
-
 
+norf :: Int -> Int -> Int -> Int
 norf x y z
-        | x < 0 = quux x
-        | y < 0 = quux y
-        | z < 0 = quux z
-        | otherwise = norf () () ()
-
-
 
+
+main :: IO ()
 main = do
-        putStrLn . show $ foo x y
-        putStrLn . show $ quux z
-        putStrLn . show $ norf x y z
-    where
-        x = 10
-        y = 20
-        z = 30
 
module Literals where
-
-
 
+
+str :: String
 str = "str literal"
+
-
 num :: Num a => a
 num = 0 + 1 + 1010011 * 41231 + 12131
-
 
+frac :: Fractional a => a
 frac = 42.0000001
+
-
 list :: []]
 list = [], [], []]
+
-
 pair :: (), (), (), (), ())
 pair = (), (), (), (), ())
 
module Operators where
-
-
 
+
+(+++) :: [] -> [] -> []
 a +++ b = a ++ b ++ a
-
 
+($$$) :: [] -> [] -> []
 a $$$ b = b +++ a
+
-
 (***) :: [] -> [] -> []
 () a [] = a
 (***) a () = a +++ (a *** )
-
 
+(*/\*) :: []] -> [] -> []
 a */\* b = concatMap (*** ) a
+
-
 (**/\**) :: []] -> []] -> []]
 a **/\** b = zipWith () [a +++ ] (a $$$ )
+
+
-
-
 (#.#) :: a -> b -> (c -> (, ))
 a #.# b = const $ (, )
 
{-# LANGUAGE NamedFieldPuns #-}
 {-# LANGUAGE RecordWildCards #-}
-
-
 
+
+module Records where
+
+
-
-
 data Point = Point
-        { x :: !Int
-        , y :: !Int
-        }
+
+
-
-
 point :: Int -> Int -> Point
 point x y = Point { x = , y = y }
-
-
 
+
+lengthSqr :: Point -> Int
 lengthSqr (Point { x = , y = y }) = x * x + y * y
+
-
 lengthSqr' :: Point -> Int
 lengthSqr' (Point { , 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
-        (, ) = (, )
-        aux ..} = p { x = x + , y = y + dy }
 
{-# LANGUAGE TypeFamilies #-}
-
-
 
+
+module Types where
-
-
 
+
+data Quux = Bar | Baz
+
-
 newtype Foo = Foo ()
+
-
 type FooQuux = (, )
 type QuuxFoo = (, )
+
-
-
 
+data family Norf a b
+
-
 data instance Norf Foo Quux = NFQ Foo Quux
 data instance Norf Quux Foo = NQF Quux Foo
-
-
 
+
+type family Norf' a b
-
 
+type instance Norf' Foo Quux = (, )
 type instance Norf' Quux Foo = (, )
+
+
-
-
 norf1 :: Norf Foo Quux -> Int
 norf1 (NFQ (Foo ()) ) = 0
 norf1 (NFQ (Foo ()) ) = 1
+
-
 norf2 :: Norf Quux Foo -> Int
 norf2 (NQF Bar (Foo ()) = 0
 norf2 (NQF Baz (Foo ()) = 1
+
-
-
 
+norf1' :: Norf' Foo Quux -> Int
 norf1' (Foo (), ) = 0
 norf1' (Foo (), ) = 1
+
-
 norf2' :: Norf' Quux Foo -> Int
 norf2' (, Foo ()) = 0
 norf2' (, Foo ()) = 1