#4479: Add Type Directed Name Resolution
----------------------------------------+-----------------------------------
Reporter: gidyn | Owner:
Type: feature request | Status: new
Priority: low | Milestone: 7.6.1
Component: Compiler (Type checker) | Version: 7.5
Keywords: | Os: Unknown/Multiple
Architecture: Unknown/Multiple | Failure: None/Unknown
Difficulty: | Testcase:
Blockedby: | Blocking:
Related: |
----------------------------------------+-----------------------------------
Comment(by AntC):
For the record(!) there's been a long and convoluted thread around
alternative proposals for the 'narrow namespacing issue' with Haskell 98's
record system. The wiki page is here:
http://hackage.haskell.org/trac/ghc/wiki/Records. (Some proposals are
developments from TDNR, using more recent features in GHC.)
I agree with SPJ for raising the importance of dot notation for record
access, and his observation about the thinking style this engenders of
object -> access, rather than Haskell's function prefix style.
But I'm against the specifics of TDNR. In particular I think there should
be only one variety of Type-Directed xxx Resolution in Haskell, and that
should be the familiar class and instance mechanism. The '''Proposal'''
says: "TDNR is not "overloading" in the sense of type classes". I think
that'll be confusing.
H98 record selectors are functions. Record selection is therefore function
application. TDNR proposes "The dynamic semantics of a.f is simply reverse
application (f a)." I think dot notation should be just sugar for
(reverse, tight-binding) function application, with the same semantics and
the same instance resolution mechanism.
http://hackage.haskell.org/trac/ghc/wiki/Records/DeclaredOverloadedRecordFields/DotPostfix
(Though I'm not going to 'die in a ditch' over which specific operator we
use in the sugar. Since dot is currently function composition, there have
been voiciferous requests to keep it so.)
So to be able to use the same field name (that is, selector function) in
multiple record types, I'd be looking to overload the function. As SPJ
notes, there are already GHC extensions (`DisambiguateRecordFields` and
friends) for other use cases of same name/multiple record types.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4479#comment:12>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs