[GHC] #14961: QuantifiedConstraints: introducing classes through equality constraints fails
GHC
ghc-devs at haskell.org
Thu Mar 22 10:03:01 UTC 2018
#14961: QuantifiedConstraints: introducing classes through equality constraints
fails
-------------------------------------+-------------------------------------
Reporter: mrkgnao | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.5
Resolution: | Keywords:
| QuantifiedConstraints wipT2893
Operating System: Unknown/Multiple | Architecture:
Type of failure: GHC rejects | Unknown/Multiple
valid program | Test Case:
Blocked By: | Blocking:
Related Tickets: #14860 | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by simonpj):
I get different results for `wip/T2893` branch. First I need
`FlexibleContexts`. Second, all the definitions fail. For the first one
I get
{{{
T14961.hs:16:8: error:
• Could not deduce: c0 a
from the context: (c ~=> Monoid, c a)
bound by the type signature for:
foo :: forall (c :: * -> Constraint) a. (c ~=> Monoid,
c a) => a
at T14961.hs:16:8-45
• In the ambiguity check for ‘foo’
To defer the ambiguity check to use sites, enable
AllowAmbiguousTypes
In the type signature:
foo :: forall c a. c ~=> Monoid => (c a => a)
|
16 | foo :: forall c a. c ~=> Monoid => (c a => a) -- ok
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
}}}
And the same happens if I simplify the type a bit more to
{{{
foo :: forall c a. (forall x. c x => Monoid x) => (c a => a) -- ok
}}}
Sure enough, this is an ambiguous type! In a call, how do you expect `c`
to be instantiated??
I'm at a loss for what you are trying to achieve here. Before we can look
at substituting equalities, we need to work out these simpler questions.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14961#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list