[GHC] #14260: Type family in instance signature confuses GHC

GHC ghc-devs at haskell.org
Wed Sep 20 20:43:34 UTC 2017


#14260: Type family in instance signature confuses GHC
-------------------------------------+-------------------------------------
           Reporter:  Iceland_jack   |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.2.1
           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:
-------------------------------------+-------------------------------------
 This works:

 {{{#!hs
 class F a where
   type T a
   u :: T a -> a -> a

 newtype W a = W a

 instance F (W a) where
   type T (W a) = T a
   u = undefined

 instance F () where
   type T () = T (W ())
   u _ = undefined
 }}}

 Remove one argument to `u` and you get

 {{{#!hs
     • Reduction stack overflow; size = 201
       When simplifying the following type: T (W ())
       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 ‘u’: u = undefined
       In the instance declaration for ‘F ()’
 }}}

 It is also not accepted to

 {{{#!hs
   u :: T (W ()) -> () -> ()
   u _ = id @()
 }}}

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


More information about the ghc-tickets mailing list