[GHC] #14266: AllowAmbiguousTypes doesn't play well with default class methods

GHC ghc-devs at haskell.org
Tue Oct 3 15:11:10 UTC 2017


#14266: AllowAmbiguousTypes doesn't play well with default class methods
-------------------------------------+-------------------------------------
        Reporter:  chris-martin      |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by RyanGlScott):

 I thoroughly regret ever mentioning `InstanceSigs`, because that has
 nothing to do with the underlying issue here, and it has completely
 derailed the discussion.

 Here is the code that should compile, but doesn't (from comment:2):

 {{{#!hs
 {-# LANGUAGE AllowAmbiguousTypes #-}
 {-# LANGUAGE ExplicitForAll #-}
 {-# LANGUAGE TypeApplications #-}

 class A t where
   f :: forall x m. Monoid x => t m -> m

 instance A [] where
   f = df @[]

 df :: forall t. A t => forall x m. Monoid x => t m -> m
 df = undefined
 }}}

 This is precisely what gets emitted with `DefaultSignatures` (module
 naming). No `InstanceSigs` to be found.

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


More information about the ghc-tickets mailing list