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/Polymorphism.html | 3183 ++++++++++++++++++++------------- 1 file changed, 1898 insertions(+), 1285 deletions(-) (limited to 'hypsrc-test/ref/src/Polymorphism.html') diff --git a/hypsrc-test/ref/src/Polymorphism.html b/hypsrc-test/ref/src/Polymorphism.html index 602246e0..91f8bd33 100644 --- a/hypsrc-test/ref/src/Polymorphism.html +++ b/hypsrc-test/ref/src/Polymorphism.html @@ -11,25 +11,25 @@ > {-# 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