[GHC] #13401: GHCi gives conflicting information about visible type application

GHC ghc-devs at haskell.org
Thu Mar 9 14:16:16 UTC 2017


#13401: GHCi gives conflicting information about visible type application
-------------------------------------+-------------------------------------
           Reporter:  crockeea       |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  GHCi           |           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 the docs for `-XVisibleTypeApplication`:

 >When printing types with `-fprint-explicit-foralls` (page 72) 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`.

 {{{
 > :set -XScopedTypeVariables
 > :set -XTypeApplications
 > :set -fprint-explicit-foralls
 > let foo :: forall a. a; foo = undefined    (LINE 1)
 > :t foo
 foo :: forall {a}. a                         (LINE 2)
 >
 > :t (foo @Bool)
 (foo @Bool) :: Bool                          (LINE 3)
 }}}

 Type application with `foo` (LINE 1) should be possible, but GHCi claims
 it is not (LINE 2), then allows it anyway (LINE 3). This looks like a bug
 with `fprint-explicit-foralls` in detecting which variables are available
 for type application.

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


More information about the ghc-tickets mailing list