From aa9644fc4179de044557438f2bd3003642750a97 Mon Sep 17 00:00:00 2001 From: Alec Theriault Date: Sun, 3 Feb 2019 22:58:58 -0800 Subject: Miscellaneous improvements to `Convert` (#1020) Now that Haddock is moving towards working entirely over `.hi` and `.hie` files, all declarations and types are going to be synthesized via the `Convert` module. In preparation for this change, here are a bunch of fixes to this module: * Add kind annotations to type variables in `forall`'s whose kind is not `Type`, unless the kind can be inferred from some later use of the variable. See `implicitForAll` and `noKindTyVars` in particular if you wish to dive into this. * Properly detect `HsQualTy` in `synifyType`. This is done by following suit with what GHC's `toIfaceTypeX` does and checking the first argument of `FunTy{} :: Type` to see if it classified as a given/wanted in the typechecker (see `isPredTy`). * Beef up the logic around figuring out when an explicit `forall` is needed. This includes: observing if any of the type variables will need kind signatures, if the inferred type variable order _without_ a forall will still match the one GHC claims, and some other small things. * Add some (not yet used) functionality for default levity polymorphic type signatures. This functionality similar to `fprint-explicit-runtime-reps`. Couple other smaller fixes only worth mentioning: * Show the family result signature only when it isn't `Type` * Fix rendering of implicit parameters in the LaTeX and Hoogle backends * Better handling of the return kind of polykinded H98 data declarations * Class decls produced by `tyThingToLHsDecl` now contain associated type defaults and default method signatures when appropriate * Filter out more `forall`'s in pattern synonyms --- html-test/ref/Bug548.html | 8 ++++++-- html-test/ref/Instances.html | 14 +++----------- html-test/ref/Operators.html | 10 +++------- html-test/ref/PatternSyns.html | 42 +++++++++++------------------------------ html-test/ref/TypeFamilies.html | 40 ++++----------------------------------- 5 files changed, 27 insertions(+), 87 deletions(-) (limited to 'html-test/ref') diff --git a/html-test/ref/Bug548.html b/html-test/ref/Bug548.html index cff64ca2..e040e603 100644 --- a/html-test/ref/Bug548.html +++ b/html-test/ref/Bug548.html @@ -148,7 +148,9 @@ >

from1 :: :: forall (a0 :: k). WrappedArrow a b a0 -> Rep1

to1 :: :: forall (a0 :: k). Rep1 (WrappedArrowInt c Bool :: Type #

Thud Int c :: Type c #

type Plugh [a] c [b] :: Type [a] c [b] #

data Thud [a] c :: Type [a] c #

pattern (:+) :: forall a. a -> a -> [a] :: a -> a -> [a]
  • datapattern (:+) :: forall a. a -> a -> [a] :: a -> a -> [a] infixr 3 +> \ No newline at end of file diff --git a/html-test/ref/PatternSyns.html b/html-test/ref/PatternSyns.html index af6d0210..6b4f8fda 100644 --- a/html-test/ref/PatternSyns.html +++ b/html-test/ref/PatternSyns.html @@ -68,9 +68,7 @@ >pattern Foo :: forall x. x -> :: x -> FooType x
  • pattern Bar :: forall x. x -> :: x -> FooType (FooTypepattern (:<->) :: forall x x1. x -> x1 -> ( :: x -> x1 -> (FooType x, FooTypepattern Blub :: () => forall x. :: () => Show x => x -> BlubTypepattern E :: forall k a (b :: k). a :: a >< b
  • pattern Foo :: forall x. x -> :: x -> FooType x #pattern Bar :: forall x. x -> :: x -> FooType (FooTypepattern (:<->) :: forall x x1. x -> x1 -> ( :: x -> x1 -> (FooType x, FooTypepattern Blub :: () => forall x. :: () => Show x => x -> BlubTypepattern E :: forall k a (b :: k). a :: a >< b # +> \ No newline at end of file diff --git a/html-test/ref/TypeFamilies.html b/html-test/ref/TypeFamilies.html index 492b7ec1..8e1e7364 100644 --- a/html-test/ref/TypeFamilies.html +++ b/html-test/ref/TypeFamilies.html @@ -286,8 +286,6 @@ >AssocD X :: Type #

    AssocT X :: Type #

    AssocD Y :: Type #

    AssocT Y :: Type #

  • BatZ1 :: forall (z :: Z). :: Z -> Bat
  • BatZ2 :: forall (z :: Z). {..} -> :: {..} -> Bat 'ZB
  • BatZ1 :: forall (z :: Z). :: Z -> Bat
  • BatZ2 :: forall (z :: Z). {..} -> :: {..} -> Bat 'ZBAssocD Y :: Type #

    AssocT Y :: Type #

    AssocD X :: Type #

    AssocT X :: Type #