[GHC] #15534: Allow associated types in Minimal pragmas

GHC ghc-devs at haskell.org
Fri Aug 17 20:27:22 UTC 2018


#15534: Allow associated types in Minimal pragmas
-------------------------------------+-------------------------------------
           Reporter:  dfeuer         |             Owner:  (none)
               Type:  feature        |            Status:  new
  request                            |
           Priority:  normal         |         Milestone:  8.8.1
          Component:  Compiler       |           Version:  8.4.3
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 Missing associated type definitions can cause compile-time problems
 similar to the run-time problems that occur when necessary methods are
 missing.

 {{{#!hs
 {-# language TypeFamilies, UndecidableInstances #-}

 class Foo a where
   type X a
   type X a = Y a

   type Y a
   type Y a = X a

 instance Foo Int

 bob :: X Int
 bob = undefined
 }}}

 Compiling this gives

 {{{
 Minim.hs:14:7: error:
     • Reduction stack overflow; size = 201
       When simplifying the following type: Y Int
       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: undefined
       In an equation for ‘bob’: bob = undefined
    |
 14 | bob = undefined
 }}}

 That's not exactly the best error message in the world. I would like to be
 able to write

 {{{#!hs
   {-# MINIMAL X | Y #-}
 }}}

 which would mean that instances should give type instances for `X` or `Y`.
 I don't see any reason to prohibit mixing associated types and methods in
 a single `MINIMAL` pragma.

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


More information about the ghc-tickets mailing list