diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2018-07-05 08:30:05 -0400 |
---|---|---|
committer | Ryan Scott <ryan.gl.scott@gmail.com> | 2018-07-05 08:48:16 -0400 |
commit | 132273f34e394bf7e900d0c15e01e91edd711890 (patch) | |
tree | f9de2ec8726a85cb8baa90691295e18a86194eb1 /testsuite/tests/deriving/should_compile/T14578.stderr | |
parent | 93b7ac8d73885369f61f6eb6147352d45de4e957 (diff) | |
download | haskell-132273f34e394bf7e900d0c15e01e91edd711890.tar.gz |
Instantiate GND bindings with an explicit type signature
Summary:
Before, we were using visible type application to apply
impredicative types to `coerce` in
`GeneralizedNewtypeDeriving`-generated bindings. This approach breaks
down when combined with `QuantifiedConstraints` in certain ways,
which #14883 and #15290 provide examples of. See
Note [GND and QuantifiedConstraints] for all the gory details.
To avoid this issue, we instead use an explicit type signature to
instantiate each GND binding, and use that to bind any type variables
that might be bound by a class method's type signature. This reduces
the need to impredicative type applications, and more importantly,
makes the programs from #14883 and #15290 work again.
Test Plan: make test TEST="T15290b T15290c T15290d T14883"
Reviewers: simonpj, bgamari
Reviewed By: simonpj
Subscribers: rwbarton, thomie, carter
GHC Trac Issues: #14883, #15290
Differential Revision: https://phabricator.haskell.org/D4895
Diffstat (limited to 'testsuite/tests/deriving/should_compile/T14578.stderr')
-rw-r--r-- | testsuite/tests/deriving/should_compile/T14578.stderr | 103 |
1 files changed, 48 insertions, 55 deletions
diff --git a/testsuite/tests/deriving/should_compile/T14578.stderr b/testsuite/tests/deriving/should_compile/T14578.stderr index acbbdd627b..9f7ef67bf3 100644 --- a/testsuite/tests/deriving/should_compile/T14578.stderr +++ b/testsuite/tests/deriving/should_compile/T14578.stderr @@ -5,69 +5,61 @@ Derived class instances: GHC.Base.Functor (T14578.App f) where GHC.Base.fmap = GHC.Prim.coerce - @(forall (a :: TYPE GHC.Types.LiftedRep) - (b :: TYPE GHC.Types.LiftedRep). - (a -> b) -> f a -> f b) - @(forall (a :: TYPE GHC.Types.LiftedRep) - (b :: TYPE GHC.Types.LiftedRep). - (a -> b) -> T14578.App f a -> T14578.App f b) - GHC.Base.fmap + @((a -> b) -> f a -> f b) + @((a -> b) -> T14578.App f a -> T14578.App f b) + GHC.Base.fmap :: + forall (a :: TYPE GHC.Types.LiftedRep) + (b :: TYPE GHC.Types.LiftedRep). + (a -> b) -> T14578.App f a -> T14578.App f b (GHC.Base.<$) = GHC.Prim.coerce - @(forall (a :: TYPE GHC.Types.LiftedRep) - (b :: TYPE GHC.Types.LiftedRep). - a -> f b -> f a) - @(forall (a :: TYPE GHC.Types.LiftedRep) - (b :: TYPE GHC.Types.LiftedRep). - a -> T14578.App f b -> T14578.App f a) - (GHC.Base.<$) + @(a -> f b -> f a) + @(a -> T14578.App f b -> T14578.App f a) + (GHC.Base.<$) :: + forall (a :: TYPE GHC.Types.LiftedRep) + (b :: TYPE GHC.Types.LiftedRep). + a -> T14578.App f b -> T14578.App f a instance GHC.Base.Applicative f => GHC.Base.Applicative (T14578.App f) where GHC.Base.pure = GHC.Prim.coerce - @(forall (a :: TYPE GHC.Types.LiftedRep). a -> f a) - @(forall (a :: TYPE GHC.Types.LiftedRep). a -> T14578.App f a) - GHC.Base.pure + @(a -> f a) @(a -> T14578.App f a) GHC.Base.pure :: + forall (a :: TYPE GHC.Types.LiftedRep). a -> T14578.App f a (GHC.Base.<*>) = GHC.Prim.coerce - @(forall (a :: TYPE GHC.Types.LiftedRep) - (b :: TYPE GHC.Types.LiftedRep). - f (a -> b) -> f a -> f b) - @(forall (a :: TYPE GHC.Types.LiftedRep) - (b :: TYPE GHC.Types.LiftedRep). - T14578.App f (a -> b) -> T14578.App f a -> T14578.App f b) - (GHC.Base.<*>) + @(f (a -> b) -> f a -> f b) + @(T14578.App f (a -> b) -> T14578.App f a -> T14578.App f b) + (GHC.Base.<*>) :: + forall (a :: TYPE GHC.Types.LiftedRep) + (b :: TYPE GHC.Types.LiftedRep). + T14578.App f (a -> b) -> T14578.App f a -> T14578.App f b GHC.Base.liftA2 = GHC.Prim.coerce - @(forall (a :: TYPE GHC.Types.LiftedRep) - (b :: TYPE GHC.Types.LiftedRep) - (c :: TYPE GHC.Types.LiftedRep). - (a -> b -> c) -> f a -> f b -> f c) - @(forall (a :: TYPE GHC.Types.LiftedRep) - (b :: TYPE GHC.Types.LiftedRep) - (c :: TYPE GHC.Types.LiftedRep). - (a -> b -> c) + @((a -> b -> c) -> f a -> f b -> f c) + @((a -> b -> c) -> T14578.App f a -> T14578.App f b -> T14578.App f c) - GHC.Base.liftA2 + GHC.Base.liftA2 :: + forall (a :: TYPE GHC.Types.LiftedRep) + (b :: TYPE GHC.Types.LiftedRep) + (c :: TYPE GHC.Types.LiftedRep). + (a -> b -> c) -> T14578.App f a -> T14578.App f b -> T14578.App f c (GHC.Base.*>) = GHC.Prim.coerce - @(forall (a :: TYPE GHC.Types.LiftedRep) - (b :: TYPE GHC.Types.LiftedRep). - f a -> f b -> f b) - @(forall (a :: TYPE GHC.Types.LiftedRep) - (b :: TYPE GHC.Types.LiftedRep). - T14578.App f a -> T14578.App f b -> T14578.App f b) - (GHC.Base.*>) + @(f a -> f b -> f b) + @(T14578.App f a -> T14578.App f b -> T14578.App f b) + (GHC.Base.*>) :: + forall (a :: TYPE GHC.Types.LiftedRep) + (b :: TYPE GHC.Types.LiftedRep). + T14578.App f a -> T14578.App f b -> T14578.App f b (GHC.Base.<*) = GHC.Prim.coerce - @(forall (a :: TYPE GHC.Types.LiftedRep) - (b :: TYPE GHC.Types.LiftedRep). - f a -> f b -> f a) - @(forall (a :: TYPE GHC.Types.LiftedRep) - (b :: TYPE GHC.Types.LiftedRep). - T14578.App f a -> T14578.App f b -> T14578.App f a) - (GHC.Base.<*) + @(f a -> f b -> f a) + @(T14578.App f a -> T14578.App f b -> T14578.App f a) + (GHC.Base.<*) :: + forall (a :: TYPE GHC.Types.LiftedRep) + (b :: TYPE GHC.Types.LiftedRep). + T14578.App f a -> T14578.App f b -> T14578.App f a instance (GHC.Base.Applicative f, GHC.Base.Applicative g, GHC.Base.Semigroup a) => @@ -81,7 +73,8 @@ Derived class instances: -> T14578.App (Data.Functor.Compose.Compose f g :: TYPE GHC.Types.LiftedRep -> TYPE GHC.Types.LiftedRep) a) @(T14578.Wat f g a -> T14578.Wat f g a -> T14578.Wat f g a) - (GHC.Base.<>) + (GHC.Base.<>) :: + T14578.Wat f g a -> T14578.Wat f g a -> T14578.Wat f g a GHC.Base.sconcat = GHC.Prim.coerce @(GHC.Base.NonEmpty (T14578.App (Data.Functor.Compose.Compose f g :: TYPE GHC.Types.LiftedRep @@ -89,19 +82,19 @@ Derived class instances: -> T14578.App (Data.Functor.Compose.Compose f g :: TYPE GHC.Types.LiftedRep -> TYPE GHC.Types.LiftedRep) a) @(GHC.Base.NonEmpty (T14578.Wat f g a) -> T14578.Wat f g a) - GHC.Base.sconcat + GHC.Base.sconcat :: + GHC.Base.NonEmpty (T14578.Wat f g a) -> T14578.Wat f g a GHC.Base.stimes = GHC.Prim.coerce - @(forall (b :: TYPE GHC.Types.LiftedRep). - GHC.Real.Integral b => - b + @(b -> T14578.App (Data.Functor.Compose.Compose f g :: TYPE GHC.Types.LiftedRep -> TYPE GHC.Types.LiftedRep) a -> T14578.App (Data.Functor.Compose.Compose f g :: TYPE GHC.Types.LiftedRep -> TYPE GHC.Types.LiftedRep) a) - @(forall (b :: TYPE GHC.Types.LiftedRep). - GHC.Real.Integral b => b -> T14578.Wat f g a -> T14578.Wat f g a) - GHC.Base.stimes + @(b -> T14578.Wat f g a -> T14578.Wat f g a) + GHC.Base.stimes :: + forall (b :: TYPE GHC.Types.LiftedRep). + GHC.Real.Integral b => b -> T14578.Wat f g a -> T14578.Wat f g a Derived type family instances: |