From 1b26460fb3b5df5215cc1e6715661cbc7c950085 Mon Sep 17 00:00:00 2001 From: Alec Theriault Date: Thu, 31 Jan 2019 01:37:25 -0800 Subject: Use `.hie` files for the Hyperlinker backend (#977) # Summary This is a large architectural change to the Hyperlinker. * extract link (and now also type) information from `.hie` instead of doing ad-hoc SYB traversals of the `RenamedSource`. Also adds a superb type-on-hover feature (#715). * re-engineer the lexer to avoid needless string conversions. By going directly through GHC's `P` monad and taking bytestring slices, we avoid a ton of allocation and have better handling of position pragmas and CPP. In terms of performance, the Haddock side of things has gotten _much_ more efficient. Unfortunately, much of this is cancelled out by the increased GHC workload for generating `.hie` files. For the full set of boot libs (including `ghc`-the-library) * the sum of total time went down by 9-10% overall * the sum of total allocations went down by 6-7% # Motivation Haddock is moving towards working entirely over `.hi` and `.hie` files. This change means we no longer need the `RenamedSource` from `TypecheckedModule` (something which is _not_ in `.hi` files). # Details Along the way a bunch of things were fixed: * Cross package (and other) links are now more reliable (#496) * The lexer tries to recover from errors on every line (instead of at CPP boundaries) * `LINE`/`COLUMN` pragmas are taken into account * filter out zero length tokens before rendering * avoid recomputing the `ModuleName`-based `SrcMap` * remove the last use of `Documentation.Haddock.Utf8` (see #998) * restructure temporary folder logic for `.hi`/`.hie` model --- hypsrc-test/ref/src/CPP.html | 197 +- hypsrc-test/ref/src/ClangCppBug.html | 306 +++ hypsrc-test/ref/src/Classes.html | 1652 ++++++++------ hypsrc-test/ref/src/Constructors.html | 1268 +++++++---- hypsrc-test/ref/src/Identifiers.html | 1485 +++++++++---- hypsrc-test/ref/src/LinkingIdentifiers.html | 572 +++++ hypsrc-test/ref/src/Literals.html | 433 ++-- hypsrc-test/ref/src/Operators.html | 1540 +++++++------ hypsrc-test/ref/src/Polymorphism.html | 3183 ++++++++++++++++----------- hypsrc-test/ref/src/PositionPragmas.html | 172 ++ hypsrc-test/ref/src/Records.html | 1346 +++++++---- hypsrc-test/ref/src/Types.html | 1022 +++++---- hypsrc-test/src/ClangCppBug.hs | 21 + hypsrc-test/src/LinkingIdentifiers.hs | 14 + hypsrc-test/src/PositionPragmas.hs | 12 + 15 files changed, 8692 insertions(+), 4531 deletions(-) create mode 100644 hypsrc-test/ref/src/ClangCppBug.html create mode 100644 hypsrc-test/ref/src/LinkingIdentifiers.html create mode 100644 hypsrc-test/ref/src/PositionPragmas.html create mode 100644 hypsrc-test/src/ClangCppBug.hs create mode 100644 hypsrc-test/src/LinkingIdentifiers.hs create mode 100644 hypsrc-test/src/PositionPragmas.hs (limited to 'hypsrc-test') diff --git a/hypsrc-test/ref/src/CPP.html b/hypsrc-test/ref/src/CPP.html index fb85bd2f..2ebcae90 100644 --- a/hypsrc-test/ref/src/CPP.html +++ b/hypsrc-test/ref/src/CPP.html @@ -11,8 +11,8 @@ > module where - -#define SOMETHING1 + > + +#define SOMETHING1 foofoo :: StringString foofoo :: String +foo "foo" - -"foo"#define SOMETHING2 + > + +#define SOMETHING2 barbar :: StringString barbar :: String +bar = "block comment in a string is not a comment {- " - -"block comment in a string is not a comment {- "#define SOMETHING3 + > + +#define SOMETHING3 -- " single quotes are fine in line comments -- {- unclosed block comments are fine in line comments -- Multiline CPP is also fine -#define FOO\ + > +#define FOO\ 1 bazbaz :: StringString bazbaz :: String +baz = "line comment in a string is not a comment --""line comment in a string is not a comment --"
{-# LANGUAGE CPP #-}
+module ClangCppBug where
+
+foo :: Int
+foo :: Int
+foo = 1
+
+-- Clang doesn't mind these:
+#define BAX 2
+{-# INLINE bar #-}
+
+bar :: Int
+bar :: Int
+bar = 3
+
+-- But it doesn't like this:
+{-# RULES
+"bar/qux" bar = qux
+"qux/foo" qux = foo
+  #-}
+
+qux :: Int
+qux :: Int
+qux = 88
+
\ No newline at end of file diff --git a/hypsrc-test/ref/src/Classes.html b/hypsrc-test/ref/src/Classes.html index d2604e82..dd1e6ebc 100644 --- a/hypsrc-test/ref/src/Classes.html +++ b/hypsrc-test/ref/src/Classes.html @@ -19,36 +19,40 @@ > class FooFoo aa barbar :: aa -> IntInt bazbaz :: IntInt (aa, aa) instance FooFoo IntInt barbar :: Int -> Int +bar = idInt -> Int +forall a. a -> a +id baz xbaz :: Int -> (Int, Int) +baz x :: Int +x (xInt +x, xInt +x) instance Foo [a] where + >instance Foo [a] where bar = length + > bar :: [a] -> Int bar = [a] -> Int +forall (t :: * -> *) a. Foldable t => t a -> Int +length + baz :: Int -> ([a], [a]) +baz baz _ = ([], [])_ = ([], []) class FooFoo aa => Foo'Foo' aa quuxquux (aa, aa)-> aa quux (x, y) = norf [x, y]quux (x :: a +x, y :: a +y) = [a] -> a +forall a. Foo' a => [a] -> a +norf [a +x, a +y] norfnorf [aa]-> aa norf = quux . baz . sum . map barnorf = (a, a) -> a +forall a. Foo' a => (a, a) -> a +quux ((a, a) -> a) -> ([a] -> (a, a)) -> [a] -> a +forall b c a. (b -> c) -> (a -> b) -> a -> c +. Int -> (a, a) +forall a. Foo a => Int -> (a, a) +baz (Int -> (a, a)) -> ([a] -> Int) -> [a] -> (a, a) +forall b c a. (b -> c) -> (a -> b) -> a -> c +. [Int] -> Int +forall (t :: * -> *) a. (Foldable t, Num a) => t a -> a +sum ([Int] -> Int) -> ([a] -> [Int]) -> [a] -> Int +forall b c a. (b -> c) -> (a -> b) -> a -> c +. (a -> Int) -> [a] -> [Int] +forall a b. (a -> b) -> [a] -> [b] +map a -> Int +forall a. Foo a => a -> Int +bar instance Foo' IntFoo' Int norfnorf :: [Int] -> Int +norf = sum[Int] -> Int +forall (t :: * -> *) a. (Foldable t, Num a) => t a -> a +sum instance Foo' [a] where + >instance Foo' [a] where quux = uncurry (++) quux :: ([a], [a]) -> [a] +quux = ([a] -> [a] -> [a]) -> ([a], [a]) -> [a] +forall a b c. (a -> b -> c) -> (a, b) -> c +uncurry [a] -> [a] -> [a] +forall a. [a] -> [a] -> [a] +(++) class PlughPlugh pp plugh :: p a a -> p b b -> p (a -> b) (b -> a)plugh :: p a a -> p b b -> p (a -> b) (b -> a) instance PlughPlugh EitherEither plughplugh :: Either a a -> Either b b -> Either (a -> b) (b -> a) +plugh (LeftLeft aa :: a +a)= Right(b -> a) -> Either (a -> b) (b -> a) +forall a b. b -> Either a b +Right $((b -> a) -> Either (a -> b) (b -> a)) +-> (b -> a) -> Either (a -> b) (b -> a) +forall a b. (a -> b) -> a -> b +$ consta -> b -> a +forall a b. a -> b -> a +const aa +a plughplugh (RightRight aa :: a +a)= Right(b -> a) -> Either (a -> b) (b -> a) +forall a b. b -> Either a b +Right $((b -> a) -> Either (a -> b) (b -> a)) +-> (b -> a) -> Either (a -> b) (b -> a) +forall a b. (a -> b) -> a -> b +$ consta -> b -> a +forall a b. a -> b -> a +const aa +a plughplugh (LeftLeft bb :: b +b)= Left(a -> b) -> Either (a -> b) (b -> a) +forall a b. a -> Either a b +Left $((a -> b) -> Either (a -> b) (b -> a)) +-> (a -> b) -> Either (a -> b) (b -> a) +forall a b. (a -> b) -> a -> b +$ constb -> a -> b +forall a b. a -> b -> a +const bb +b plughplugh (RightRight bb :: b +b)= Left(a -> b) -> Either (a -> b) (b -> a) +forall a b. a -> Either a b +Left $((a -> b) -> Either (a -> b) (b -> a)) +-> (a -> b) -> Either (a -> b) (b -> a) +forall a b. (a -> b) -> a -> b +$ constb -> a -> b +forall a b. a -> b -> a +const bb +b data FooFoo = BarBar | BazBaz | QuuxQuux FooFoo IntInt newtype NorfNorf = NorfNorf (FooFoo, [FooFoo], FooFoo) barbar, bazbaz, quuxquux :: FooFoo barbar :: Foo +bar = BarFoo +Bar bazbaz :: Foo +baz = BazFoo +Baz quuxquux :: Foo +quux = QuuxFoo -> Int -> Foo +Quux quuxFoo +quux 00 unfoounfoo :: FooFoo -> IntInt unfoounfoo :: Foo -> Int +unfoo BarBar = 00 unfoounfoo BazBaz = 00 unfoounfoo (Quux fooQuux nfoo :: Foo +foo n :: Int +n)= 4242 *Int -> Int -> Int +forall a. Num a => a -> a -> a +* nInt +n +Int -> Int -> Int +forall a. Num a => a -> a -> a ++ unfooFoo -> Int +unfoo fooFoo +foo unnorfunnorf :: NorfNorf [FooFoo] unnorfunnorf :: Norf -> [Foo] +unnorf (NorfNorf (BarBar, xsxs :: [Foo] +xs, BarBar)= xs[Foo] +xs unnorfunnorf (NorfNorf (BazBaz, xsxs :: [Foo] +xs, BazBaz)= reverse[Foo] -> [Foo] +forall a. [a] -> [a] +reverse xs[Foo] +xs unnorfunnorf = undefined[Foo] +forall a. HasCallStack => a +undefined unnorf'unnorf' :: NorfNorf -> IntInt unnorf' xunnorf' :: Norf -> Int +unnorf' x :: Norf +x@(NorfNorf (f1f1 :: Foo +f1@(QuuxQuux _ nn :: Int +n), f2f2 :: Foo +f2@(QuuxQuux f3f3 :: Foo +f3 x'Int +x' +Int -> Int -> Int +forall a. Num a => a -> a -> a ++ nInt +n *Int -> Int -> Int +forall a. Num a => a -> a -> a +* unfooFoo -> Int +unfoo f1Foo +f1 +Int -> Int -> Int +forall a. Num a => a -> a -> a ++ auxFoo -> Int +aux f3Foo +f3 aux fxaux :: Foo -> Int +aux fx :: Foo +fx = unfooFoo -> Int +unfoo f2Foo +f2 *Int -> Int -> Int +forall a. Num a => a -> a -> a +* unfooFoo -> Int +unfoo fxFoo +fx *Int -> Int -> Int +forall a. Num a => a -> a -> a +* unfooFoo -> Int +unfoo f3Foo +f3 x'x' :: Int +x' = sum[Int] -> Int +forall (t :: * -> *) a. (Foldable t, Num a) => t a -> a +sum .([Int] -> Int) -> (Norf -> [Int]) -> Norf -> Int +forall b c a. (b -> c) -> (a -> b) -> a -> c +. map(Foo -> Int) -> [Foo] -> [Int] +forall a b. (a -> b) -> [a] -> [b] +map unfooFoo -> Int +unfoo .([Foo] -> [Int]) -> (Norf -> [Foo]) -> Norf -> [Int] +forall b c a. (b -> c) -> (a -> b) -> a -> c +. unnorfNorf -> [Foo] +unnorf $(Norf -> Int) -> Norf -> Int +forall a b. (a -> b) -> a -> b +$ xNorf +x foofoo, barbar, bazbaz :: IntInt -> IntInt -> IntInt foo x yfoo :: Int -> Int -> Int +foo x :: Int +x y :: Int +y = x + xInt +x *Int -> Int -> Int +forall a. Num a => a -> a -> a ++ barInt +x yInt -> Int -> Int +forall a. Num a => a -> a -> a +* xInt -> Int -> Int +bar *Int +y yInt +x +Int -> Int -> Int +forall a. Num a => a -> a -> a +* y + >Int bary xInt -> Int -> Int +forall a. Num a => a -> a -> a ++ Int +y +bar :: Int -> Int -> Int +bar x :: Int +x y :: Int +y = y + xInt +y -Int -> Int -> Int +forall a. Num a => a -> a -> a ++ bazInt +x xInt -> Int -> Int +forall a. Num a => a -> a -> a +- yInt -> Int -> Int +baz -Int +x xInt +y +Int -> Int -> Int +forall a. Num a => a -> a -> a +- y + >Int bazx xInt -> Int -> Int +forall a. Num a => a -> a -> a ++ Int +y +baz :: Int -> Int -> Int +baz x :: Int +x y :: Int +y = xInt +x *Int -> Int -> Int +forall a. Num a => a -> a -> a +* yInt +y *Int -> Int -> Int +forall a. Num a => a -> a -> a +* yInt +y *Int -> Int -> Int +forall a. Num a => a -> a -> a +* yInt +y *Int -> Int -> Int +forall a. Num a => a -> a -> a +* xInt +x quuxquux :: IntInt -> IntInt quux xquux :: Int -> Int +quux x :: Int +x = fooInt -> Int -> Int +foo (barInt -> Int -> Int +bar xInt +x xInt +x) (barInt -> Int -> Int +bar xInt +x xInt +x) norfnorf :: IntInt -> IntInt -> IntInt -> IntInt norf x y znorf :: Int -> Int -> Int -> Int +norf x :: Int +x y :: Int +y z :: Int +z | xInt +x <Int -> Int -> Bool +forall a. Ord a => a -> a -> Bool +< 00 = quuxInt -> Int +quux xInt +x | yInt +y <Int -> Int -> Bool +forall a. Ord a => a -> a -> Bool +< 00 = quuxInt -> Int +quux yInt +y | zInt +z <Int -> Int -> Bool +forall a. Ord a => a -> a -> Bool +< 00 = quuxInt -> Int +quux zInt +z | otherwiseBool +otherwise = norfInt -> Int -> Int -> Int +norf (-xInt +x)(-yInt +y)(-zInt +z) mainmain :: IOIO mainmain :: IO () +main putStrLnString -> IO () +putStrLn .(String -> IO ()) -> (Int -> String) -> Int -> IO () +forall b c a. (b -> c) -> (a -> b) -> a -> c +. showInt -> String +forall a. Show a => a -> String +show $(Int -> IO ()) -> Int -> IO () +forall a b. (a -> b) -> a -> b +$ fooInt -> Int -> Int +foo xInt +x yInt +y putStrLnString -> IO () +putStrLn .(String -> IO ()) -> (Int -> String) -> Int -> IO () +forall b c a. (b -> c) -> (a -> b) -> a -> c +. showInt -> String +forall a. Show a => a -> String +show $(Int -> IO ()) -> Int -> IO () +forall a b. (a -> b) -> a -> b +$ quuxInt -> Int +quux zInt +z putStrLnString -> IO () +putStrLn .(String -> IO ()) -> (Int -> String) -> Int -> IO () +forall b c a. (b -> c) -> (a -> b) -> a -> c +. showInt -> String +forall a. Show a => a -> String +show $(Int -> IO ()) -> Int -> IO () +forall a b. (a -> b) -> a -> b +$ Identifiers.norfInt -> Int -> Int -> Int +Identifiers.norf xInt +x yInt +y zInt +z xx :: Int +x = 1010 yy :: Int +y = 2020 zz :: Int +z = 3030 +> \ No newline at end of file diff --git a/hypsrc-test/ref/src/LinkingIdentifiers.html b/hypsrc-test/ref/src/LinkingIdentifiers.html new file mode 100644 index 00000000..2ef590bd --- /dev/null +++ b/hypsrc-test/ref/src/LinkingIdentifiers.html @@ -0,0 +1,572 @@ +
-- Tests that the identifers/operators are properly linked even when:
+--
+--   * backquoted, parenthesized, vanilla
+--   * qualified, not-qualified
+--
+module LinkingIdentifiers where
+
+ident :: Int -> Int -> Int
+x :: Int
+x ident :: Int -> Int -> Int
+`ident` 2 = (Int
+x Int -> Int -> Int
+`ident` 2) Int -> Int -> Int
+forall a. Num a => a -> a -> a
++ (Int
+x Int -> Int -> Int
+`LinkingIdentifiers.ident` 2)
+ident x :: Int
+x 2 = Int -> Int -> Int
+ident Int
+x 2 Int -> Int -> Int
+forall a. Num a => a -> a -> a
++ Int -> Int -> Int
+LinkingIdentifiers.ident Int
+x 2
+
+(++:++) :: Int -> Int -> Int
+x :: Int
+x ++:++ :: Int -> Int -> Int
+++:++ 2 = (Int
+x Int -> Int -> Int
+++:++ 2) Int -> Int -> Int
+forall a. Num a => a -> a -> a
++ (Int
+x Int -> Int -> Int
+LinkingIdentifiers.++:++ 2)
+(++:++) x :: Int
+x 2 = Int -> Int -> Int
+(++:++) Int
+x 2 Int -> Int -> Int
+forall a. Num a => a -> a -> a
++ Int -> Int -> Int
+(LinkingIdentifiers.++:++) Int
+x 2
+
\ No newline at end of file diff --git a/hypsrc-test/ref/src/Literals.html b/hypsrc-test/ref/src/Literals.html index dfcefc97..62ea32dd 100644 --- a/hypsrc-test/ref/src/Literals.html +++ b/hypsrc-test/ref/src/Literals.html @@ -19,238 +19,334 @@ > strstr :: StringString strstr :: String +str = "str literal""str literal" num :: Num a => anum :: Num a => a numnum :: a +num = 00 +a -> a -> a +forall a. Num a => a -> a -> a ++ 11 +a -> a -> a +forall a. Num a => a -> a -> a ++ 10100111010011 *a -> a -> a +forall a. Num a => a -> a -> a +* 4123141231 +a -> a -> a +forall a. Num a => a -> a -> a ++ 1213112131 frac :: Fractional a => afrac :: Fractional a => a fracfrac :: a +frac = 42.000000142.0000001 list :: [[[[a]]]]list :: [[[[a]]]] listlist :: [[[[a]]]] +list pairpair pairpair :: ((), ((), (), ()), ()) +pair (+++) ::(+++) :: [a] -> [a] -> [a] [a] -> [a] +a :: [a] +a +++ :: [a] -> [a] -> [a] ++++ b :: [a] +b ->= [a] + >[a] a +++[a] -> [a] -> [a] +forall a. [a] -> [a] -> [a] +++ [a] +b = a ++ b ++[a] -> [a] -> [a] +forall a. [a] -> [a] -> [a] +++ a[a] +a ($$$) ::($$$) :: [a] -> [a] -> [a] [a] -> [a] +a :: [a] +a $$$ :: [a] -> [a] -> [a] +$$$ b :: [a] +b ->= [a] + >[a] ab $$$[a] -> [a] -> [a] +forall a. [a] -> [a] -> [a] ++++ b[a] +a = b +++ a (***) :: [a] -> [a] -> [a](***) :: [a] -> [a] -> [a] (***) a*** :: [a] -> [a] -> [a] +(***) a :: [a] +a = a[a] +a (***)(***) aa :: [a] +a (_:b:b :: [a] +b)= a[a] +a +++[a] -> [a] -> [a] +forall a. [a] -> [a] -> [a] ++++ (a[a] +a ***[a] -> [a] -> [a] +forall a. [a] -> [a] -> [a] +*** b[a] +b) (*/\*) :: [[a]] -> [a] -> [a](*/\*) :: [[a]] -> [a] -> [a] a */\* ba :: [[a]] +a */\* :: [[a]] -> [a] -> [a] +*/\* b :: [a] +b = concatMap([a] -> [a]) -> [[a]] -> [a] +forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b] +concatMap (***[a] -> [a] -> [a] +forall a. [a] -> [a] -> [a] +*** b[a] +b) a[[a]] +a (**/\**)(**/\**) :: [[a]] -> [[a]] -> [[a]] :: [[a]] +a :: [[a]] +a **/\** :: [[a]] -> [[a]] -> [[a]] +**/\** b :: [[a]] +b ->= [[a]]([[a]] -> [a] -> [a]) -> [[[a]]] -> [[a]] -> [[a]] +forall a b c. (a -> b -> c) -> [a] -> [b] -> [c] +zipWith ->[[a]] -> [a] -> [a] +forall a. [[a]] -> [a] -> [a] +(*/\*) [[a]] + >[[a]] a **/\**[[a]] -> [[a]] -> [[a]] +forall a. [a] -> [a] -> [a] ++++ [[a]] +b = zipWith (*/\*) [a +++ b] (a[[a]] +a $$$[[a]] -> [[a]] -> [[a]] +forall a. [a] -> [a] -> [a] +$$$ b[[a]] +b) (#.#) :: a -> b -> (c -> (a, b))(#.#) :: a -> b -> (c -> (a, b)) a #.# ba :: a +a #.# :: a -> b -> c -> (a, b) +#.# b :: b +b = const(a, b) -> c -> (a, b) +forall a b. a -> b -> a +const $((a, b) -> c -> (a, b)) -> (a, b) -> c -> (a, b) +forall a b. (a -> b) -> a -> b +$ (aa +a, bb +b) {-# LANGUAGE ScopedTypeVariables #-} module - -foo :: a -> a -> a -foo + +foo :: a -> a -> a +foo :: a -> a -> a +foo = undefineda -> a -> a +forall a. HasCallStack => a +undefined foo'foo' forall aa. aa -> aa -> a -foo'a = undefined + >foo' :: a -> a -> a bar :: a -> bfoo' -> (a,= b) -bara -> a -> a +forall a. HasCallStack => a +undefined + +bar :: a -> b -> (a, b) +bar :: a -> b -> (a, b) +bar = undefineda -> b -> (a, b) +forall a. HasCallStack => a +undefined bar'bar' forall a ba b. aa -> bb (aa, bb) bar'bar' :: a -> b -> (a, b) +bar' = undefineda -> b -> (a, b) +forall a. HasCallStack => a +undefined + +baz :: a -> (a -> [a -> a] -> b) -> b +baz :: a -> (a -> [a -> a] -> b) -> b +baz = a -> (a -> [a -> a] -> b) -> b +forall a. HasCallStack => a +undefined bazbaz' :: forall a b. aa (aa [aa -> aa]-> bb)-> bb bazbaz' :: a -> (a -> [a -> a] -> b) -> b +baz' = a -> (a -> [a -> a] -> b) -> b +forall a. HasCallStack => a +undefined + +quux :: a -> (forall a. a -> a) -> a +quux :: a -> (forall a. a -> a) -> a +quux x :: a +x f :: forall a. a -> a +f = undefineda -> a +forall a. a -> a +f a +x baz'quux' forall a ba. aa (aforall ->a. [aa -> aa]) -> b)a +quux' :: a -> (forall a. a -> a) -> a +quux' x :: a +x f :: forall a. a -> a +f ->= ba -> a +forall a. a -> a +f + > a baz'x + + +num :: Num a => a -> a -> a +num :: a -> a -> a +num = undefineda -> a -> a +forall a. HasCallStack => a +undefined quuxnum' :: a -> (forall aa. a -> a) -> a -quux xNum fa = f x - -quux' :: forall=> a. a -> (forall a. a -> a) -> a -quux' x fa = f x - - num :: Num a => a -> a -> a + >num' :: a -> a -> a numnum' = undefined - -num' :: forall a. Num a => a -> a -> a -num'a -> a -> a +forall a. HasCallStack => a +undefined + +eq :: (Eq a, Eq b) => [a] -> [b] -> (a, b) +eq :: [a] -> [b] -> (a, b) +eq = undefined + >[a] -> [b] -> (a, b) +forall a. HasCallStack => a undefined eq :: (Eq a, Eq b) => [a] -> [b] -> (a, b) eqeq' = undefined - -eq' forall a ba b. (Eq a, Eq b) => [a] -> [b] -> (a, b) -eq' = undefined - -mon :: Monad m => (a -> m a) -> m a -mon = undefined - -mon' :: forall m(Eq a., MonadEq mb) ([aa] -> [m ab)] -> (ma, ab) mon'eq' :: [a] -> [b] -> (a, b) +eq' = undefined[a] -> [b] -> (a, b) +forall a. HasCallStack => a +undefined + +mon :: Monad m => (a -> m a) -> m a +mon :: (a -> m a) -> m a +mon + > = (a -> m a) -> m a +forall a. HasCallStack => a undefined norfmon' :: a -> (forall am a. OrdMonad am => (aa -> am a)-> a -norfm xa +mon' :: (a -> m a) -> m a +mon' f= (a -> m a) -> m a +forall a. HasCallStack => a +undefined + + +norf :: a -> (forall a. Ord a => a -> a) -> a +norf :: a -> (forall a. Ord a => a -> a) -> a +norf x :: a +x f :: forall a. Ord a => a -> a +f = xa +x norf'norf' forall aa. aa forall aa. OrdOrd aa => aa -> aa)-> aa norf'norf' :: a -> (forall a. Ord a => a -> a) -> a +norf' xx :: a +x ff :: forall a. Ord a => a -> a +f = xa +x plughplugh forall aa. aa -> aa plughplugh :: a -> a +plugh xx :: a +x = xa +x :: aa thudthud forall a ba b. (aa -> bb)-> aa (aa, bb) thudthud :: (a -> b) -> a -> (a, b) +thud ff :: a -> b +f xx :: a +x (xa +x :: aa, yb +y) (aa, bb) yy :: b +y (fa -> b +f :: aa -> bb) xa +x :: bb
module PositionPragmas where
+
+{-# LINE 8 "hypsrc-test/src/PositionPragmas.hs" #-}
+
+foo :: String
+foo :: String
+foo = String
+bar
+
+{-# LINE 23 "hypsrc-test/src/PositionPragmas.hs" #-}
+
+bar :: String
+bar :: String
+bar = String
+foo 
+
+
\ No newline at end of file diff --git a/hypsrc-test/ref/src/Records.html b/hypsrc-test/ref/src/Records.html index 7d23d114..bc99cc56 100644 --- a/hypsrc-test/ref/src/Records.html +++ b/hypsrc-test/ref/src/Records.html @@ -11,25 +11,25 @@ > {-# LANGUAGE RecordWildCards #-} module data PointPoint = PointPoint { xPoint -> Int +x !IntInt , yPoint -> Int +y !IntInt
pointpoint :: IntInt -> IntInt
-> PointPoint point x ypoint :: Int -> Int -> Point +point x :: Int +x y :: Int +y = Point$WPoint :: Int -> Int -> Point +Point { xx :: Int +x = xInt +x, yy :: Int +y = yInt +y lengthSqrlengthSqr :: PointPoint -> IntInt lengthSqrlengthSqr :: Point -> Int +lengthSqr (PointPoint { xx :: Point -> Int +x = xInt +x, yy :: Point -> Int +y = yInt +y = xInt +x *Int -> Int -> Int +forall a. Num a => a -> a -> a +* xInt +x +Int -> Int -> Int +forall a. Num a => a -> a -> a ++ yInt +y *Int -> Int -> Int +forall a. Num a => a -> a -> a +* yInt +y lengthSqr'lengthSqr' :: PointPoint -> IntInt lengthSqr'lengthSqr' :: Point -> Int +lengthSqr' (PointPoint { xInt +x :: Int +x :: Point -> Int +x, yInt +y :: Int +y :: Point -> Int +y = yInt +y *Int -> Int -> Int +forall a. Num a => a -> a -> a +* yInt +y +Int -> Int -> Int +forall a. Num a => a -> a -> a ++ xInt +x *Int -> Int -> Int +forall a. Num a => a -> a -> a +* xInt +x translateXtranslateX, translateYtranslateY :: PointPoint -> IntInt -> PointPoint translateX p dtranslateX :: Point -> Int -> Point +translateX p :: Point +p d :: Int +d = pPoint +p { xx :: Int +x = xPoint -> Int +x pPoint +p +Int -> Int -> Int +forall a. Num a => a -> a -> a ++ dInt +d translateY p dtranslateY :: Point -> Int -> Point +translateY p :: Point +p d :: Int +d = pPoint +p { yy :: Int +y = yPoint -> Int +y pPoint +p +Int -> Int -> Int +forall a. Num a => a -> a -> a ++ dInt +d translatetranslate :: IntInt -> IntInt -> PointPoint -> PointPoint translate x y ptranslate :: Int -> Int -> Point -> Point +translate x :: Int +x y :: Int +y p :: Point +p auxPoint -> Point +aux pPoint +p (dxdx :: Int +dx, dydy :: Int +dy) (xInt +x, yInt +y) aux Point{..}aux :: Point -> Point +aux Point{..} = pPoint +p { xx :: Int +x = xInt +x +Int -> Int -> Int +forall a. Num a => a -> a -> a ++ dxInt +dx, yy :: Int +y = yInt +y +Int -> Int -> Int +forall a. Num a => a -> a -> a ++ dyInt +dy module data QuuxQuux = BarBar | BazBaz newtype FooFoo = FooFoo type FooQuuxFooQuux (FooFoo, QuuxQuux) type QuuxFooQuuxFoo (QuuxQuux, FooFoo) datafamily NorfNorf aa bb datainstance NorfNorf FooFoo QuuxQuux = NFQNFQ FooFoo QuuxQuux datainstance NorfNorf QuuxQuux FooFoo = NQFNQF QuuxQuux FooFoo typefamily Norf'Norf' aa bb typeinstance Norf'Norf' FooFoo QuuxQuux (FooFoo, QuuxQuux) typeinstance Norf'Norf' QuuxQuux FooFoo (QuuxQuux, FooFoo) norf1norf1 :: NorfNorf FooFoo QuuxQuux -> IntInt norf1norf1 :: Norf Foo Quux -> Int +norf1 (NFQNFQ (FooFoo ) BarBar)= 00 norf1norf1 (NFQNFQ (FooFoo ) BazBaz)= 11 norf2norf2 :: NorfNorf QuuxQuux FooFoo -> IntInt norf2norf2 :: Norf Quux Foo -> Int +norf2 (NQFNQF BarBar (FooFoo = 00 norf2norf2 (NQFNQF BazBaz (FooFoo = 11 norf1'norf1' :: Norf'Norf' FooFoo QuuxQuux -> IntInt norf1'norf1' :: Norf' Foo Quux -> Int +norf1' (FooFoo , BarBar)= 00 norf1'norf1' (FooFoo , BazBaz)= 11 norf2'norf2' :: Norf'Norf' QuuxQuux FooFoo -> IntInt norf2'norf2' :: Norf' Quux Foo -> Int +norf2' (BarBar, FooFoo = 00 norf2'norf2' (BazBaz, FooFoo = 11 Int -> Int +x `ident` 2 = (x `ident` 2) + (x `LinkingIdentifiers.ident` 2) +ident x 2 = ident x 2 + LinkingIdentifiers.ident x 2 + +(++:++) :: Int -> Int -> Int +x ++:++ 2 = (x ++:++ 2) + (x LinkingIdentifiers.++:++ 2) +(++:++) x 2 = (++:++) x 2 + (LinkingIdentifiers.++:++) x 2 diff --git a/hypsrc-test/src/PositionPragmas.hs b/hypsrc-test/src/PositionPragmas.hs new file mode 100644 index 00000000..907316fd --- /dev/null +++ b/hypsrc-test/src/PositionPragmas.hs @@ -0,0 +1,12 @@ +module PositionPragmas where + +{-# LINE 8 "hypsrc-test/src/PositionPragmas.hs" #-} + +foo :: String +foo = bar + +{-# LINE 23 "hypsrc-test/src/PositionPragmas.hs" #-} + +bar :: String +bar = foo + -- cgit v1.2.3