[GHC] #14879: QuantifiedConstraints: Big error message + can't substitute (=>) with a class alias

GHC ghc-devs at haskell.org
Fri Mar 2 18:28:53 UTC 2018


#14879: QuantifiedConstraints: Big error message + can't substitute (=>) with a
class alias
-------------------------------------+-------------------------------------
           Reporter:  Iceland_jack   |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.5
           Keywords:                 |  Operating System:  Unknown/Multiple
  QuantifiedConstraints, wipT2893    |
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 This compiles fine

 {{{#!hs
 {-# 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?)

 {{{#!hs
 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>
 }}}

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14879>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list