[GHC] #12601: explicit foralls do not distinguish applicable types

GHC ghc-devs at haskell.org
Fri Sep 16 17:57:45 UTC 2016


#12601: explicit foralls do not distinguish applicable types
-------------------------------------+-------------------------------------
           Reporter:  dmwit          |             Owner:
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.0.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:
-------------------------------------+-------------------------------------
 From
 [https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html
 #visible-type-application the documentation for TypeApplications]:

 "When printing types with -fprint-explicit-foralls enabled, type variables
 not available for visible type application are printed in braces. Thus, if
 you write myLength = length without a type signature, myLength‘s inferred
 type will be forall {f} {a}. Foldable f => f a -> Int."

 This implies that type variables that ''are'' available for type
 application are ''not'' printed braces (though I admit that it doesn't say
 so outright!). With that in mind, I find the following behavior confusing:

 {{{
 > :set -XTypeApplications -fprint-explicit-foralls
 > :t (1 :: Num a => a)
 (1 :: Num a => a) :: forall {a}. Num a => a
 > (1 :: Num a => a) @Int
 1
 }}}

 The :t query seems to indicate that the type variable is not available,
 but the evaluation query seems to indicate that it is.

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


More information about the ghc-tickets mailing list