[GHC] #5296: Add explicit type applications
GHC
ghc-devs at haskell.org
Wed Mar 2 20:55:29 UTC 2016
#5296: Add explicit type applications
-------------------------------------+-------------------------------------
Reporter: dsf | Owner: goldfire
Type: feature request | Status: closed
Priority: low | Milestone: 8.0.1
Component: Compiler (Type | Version: 7.0.3
checker) |
Resolution: fixed | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: GHC rejects | Test Case:
valid program | typecheck/should_compile/Vta{1,2}
| typecheck/should_fail/VtaFail
Blocked By: 1897 | Blocking: 10770
Related Tickets: #4466 | Differential Rev(s): Phab:D1681
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by andrewthad):
This might be a little too late, but I wanted to raise an about the
relationship this has with AllowAmbiguousTypes. I haven't tried it out
yet, but based on an earlier comment in this thread, I think that turning
on VisibleTypeApplication will also turn on AllowAmbiguousTypes. I don't
think that this is necessary, and I think that there are situation where
it is detrimental the library users. Let's say that I have a `Rec` from
`vinyl` and I'm using `rget` from `Data.Vinyl.Lens`. Today, if I have
`myRec :: Rec Identity '[Char,Bool,Int]`, I can write `rget (Proxy ::
Proxy Int) myRec` to get the `Int` value out. In the future, it may be
desirable to write a function `rget2` that can take the argument by
VisibleTypeApplication instead. So, we would call `rget2 @Int myRec`
instead.
Here's the issue that I'm getting at. What does an end user have to enable
to be able to use `rget2`? At the definition site, in the case of `rget2`,
we actually don't need AllowAmbiguousTypes, but let's pretend that we did
(I should have picked a different example). When a user turns on
VisibleTypeApplication to be able to use a function that will otherwise
have ambiguous type variable instantiation, I don't think that they should
get AllowAmbiguousTypes turned on as well. If I understand correctly,
AllowAmbiguousTypes is only needed to define these functions, not to use
them.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/5296#comment:29>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list