[GHC] #11352: Allow applying type to label
GHC
ghc-devs at haskell.org
Tue Jan 5 19:11:22 UTC 2016
#11352: Allow applying type to label
-------------------------------------+-------------------------------------
Reporter: Iceland_jack | Owner:
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler (Type | Version: 7.11
checker) |
Resolution: | Keywords: ORF
Operating System: Unknown/Multiple | Architecture:
Type of failure: GHC rejects | Unknown/Multiple
valid program | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Changes (by adamgundry):
* owner: adamgundry =>
Comment:
Hmm, this isn't as straightforward as I thought. We could change the type
of `fromLabel` to be `forall x a . IsLabel x a => a`, and then implement
`#answer` by replacing it with `fromLabel @"answer"`. That gives you the
behaviour you want, but it means that error messages mention applications
of `fromLabel`, e.g.
{{{
Could not deduce (IsLabel "y" t)
arising from the overloaded label ‘#y’
}}}
becomes
{{{
Could not deduce (IsLabel "y" t)
arising from a use of ‘fromLabel’
}}}
which is somewhat undesirable. Moreover, overloaded string/numeric
literals are similarly incompatible with visible type application. So I'm
inclined to leave things as they are: after all, you can always write
`#answer :: Int`.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11352#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list