[GHC] #13401: GHCi gives conflicting information about visible type application
GHC
ghc-devs at haskell.org
Thu Mar 9 19:14:37 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
Resolution: | Keywords:
| TypeApplications
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: #11376, #11975 | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by RyanGlScott):
It's not that the information that `:type` gives is wrong, it's just not
what you're asking for. `:type foo` gives you the visibility of `foo` as
an expression post-typechecking. This can be quite handy when you have,
say:
{{{
λ> let foo :: a; foo = undefined
λ> :type foo @Int
foo @Int :: Int
λ> :type foo
foo :: forall {a}. a
λ> let goo = foo
λ> :type goo
goo :: forall {a}. a
λ> :type goo @Int
}}}
Notice that you can't use VTA with `goo`, since its type (which is the
same as `foo`, post-typechecking) doesn't have any visible type variables.
This is precisely what `:type foo` warned us about, and I'd hate to
cripple a legitimately useful feature for the benefit of a degenerate
case.
My suggestion would be to include a blurb in the users' guide section that
gives an example of asking GHCi for the visibility of a top-level
expression (using `:type +v`), and then show the pitfalls of using
`:type`. Would you be satisfied with that?
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13401#comment:6>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list