QuantifiedConstraints: Big error message + can't substitute (=>) with a class alias
This compiles fine
{-# Language QuantifiedConstraints, FlexibleInstances, MultiParamTypeClasses, ConstraintKinds, UndecidableInstances, GADTs, TypeOperators #-}
class (a => b) => Implies a b
instance (a => b) => Implies a b
data Dict c where
Dict :: c => Dict c
type a :- b = Dict (Implies a b)
class (forall xx. Implies b xx => Implies a xx) => Yo a b
instance (forall xx. Implies b xx => Implies a xx) => Yo a b
yo :: Yo a b :- Implies a b
yo = Dict
until you replace (=>)
with Implies
(which should be fine?)
class (forall xx. Implies b xx `Implies` Implies a xx) => Yo a b
instance (forall xx. Implies b xx `Implies` Implies a xx) => Yo a b
and the error message blows up
$ ghci -ignore-dot-ghci SD.hs
GHCi, version 8.5.20180128: http://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling Main ( SD.hs, interpreted )
SD.hs:15:6: error:
• Reduction stack overflow; size = 201
When simplifying the following type:
Implies
b
(Implies
b
(Implies
-->8---->8----several-hundred-lines---->8---->8----
b)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
Use -freduction-depth=0 to disable this check
(any upper bound you could choose might fail unpredictably with
minor updates to GHC, so disabling the check is recommended if
you're sure that type checking should terminate)
• In the expression: Dict
In an equation for ‘yo’: yo = Dict
|
15 | yo = Dict
| ^^^^
Failed, no modules loaded.
Prelude>
Trac metadata
Trac field | Value |
---|---|
Version | 8.5 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |