[GHC] #14897: QuantifiedConstraints: Can't print type of quantified constraint

GHC ghc-devs at haskell.org
Tue Mar 6 14:47:06 UTC 2018


#14897: QuantifiedConstraints: Can't print type of quantified constraint
-------------------------------------+-------------------------------------
           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:
-------------------------------------+-------------------------------------
 {{{#!hs
 {-# Language QuantifiedConstraints, FlexibleInstances,
 UndecidableInstances, MonoLocalBinds #-}

 class    (forall xx. Functor (f xx)) => Functor' f
 instance (forall xx. Functor (f xx)) => Functor' f

 fmap' :: Functor' f => (b -> b') -> (f a b -> f a b')
 fmap' = fmap
 }}}

 load in ghci and check the type of `fmap'`

 {{{
 $ ... -ignore-dot-ghci Bug2.hs
 GHCi, version 8.5.20180128: http://www.haskell.org/ghc/  :? for help
 [1 of 1] Compiling Main             ( Bug2.hs, interpreted )
 Ok, one module loaded.
 *Main> :t fmap'

 <interactive>:1:1: error:
     No instance for (Functor (f xx)) arising from a use of ‘fmap'’
 *Main>
 }}}

 Simpler example

 {{{
 GHCi, version 8.5.20180128: http://www.haskell.org/ghc/  :? for help
 Prelude> :set -XRankNTypes -XQuantifiedConstraints
 Prelude> let a :: (forall xx. Monoid (f xx)) => f a; a = mempty
 Prelude> :t a

 <interactive>:1:1: error:
     No instance for (Monoid (f xx)) arising from a use of ‘a’
 Prelude>
 }}}

 I expected the same output as `:t +v`

 {{{
 Prelude> :t +v a
 a :: (forall xx. Monoid (f xx)) => f a
 }}}

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


More information about the ghc-tickets mailing list