GHCi gives conflicting information about visible type application
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 writemyLength = length
without a type signature,myLength
‘s inferred type will beforall {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.
Trac metadata
Trac field | Value |
---|---|
Version | 8.0.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | GHCi |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |