[GHC] #16110: Explicit foralls in associated type family defaults are completely ignored?

GHC ghc-devs at haskell.org
Wed Jan 9 01:46:05 UTC 2019


#16110: Explicit foralls in associated type family defaults are completely ignored?
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.7
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  GHC accepts       |  Unknown/Multiple
  invalid program                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by RyanGlScott):

 Slightly tangential question: why do type family defaults need type
 variable binders in the first place? After all, the arguments in a type
 family default must always be type variables anyway—if you try otherwise:

 {{{#!hs
 class C a where
   type T a
   type T Int = Int
 }}}

 Then GHC will just reject it:

 {{{
     Unexpected type ‘Int’
     In the default declaration for ‘T’
     A default declaration should have form
       default T a = ...
 }}}

 (That error message is a bit skeevy, since you're not supposed to put the
 word "`default`" at the front like that. But that's a separate issue.)

 Given that type family default arguments are required to be all type
 variables anyway, does it really benefit us to have an explicit `forall`
 to bind them? (We don't do this for data, class, or type family
 declarations, for instance.) Or am I missing something obvious?

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


More information about the ghc-tickets mailing list