GHC support for the new "record" package
Adam Gundry
adam at well-typed.com
Fri Jan 23 10:25:33 UTC 2015
On 23/01/15 10:17, Simon Marlow wrote:
> On 23/01/2015 04:12, Johan Tibell wrote:
>>
>>
>> On Wed, Jan 21, 2015 at 5:48 PM, Simon Marlow <marlowsd at gmail.com
>> <mailto:marlowsd at gmail.com>> wrote:
>>
>> On 21/01/2015 16:01, Johan Tibell wrote:
>>
>> My thoughts mostly mirror those of Adam and Edward.
>>
>> 1) I want something that is backwards compatible.
>>
>>
>> Backwards compatible in what sense? Extension flags provide
>> backwards compatibility, because you just don't turn on the
>> extension until you want to use it. That's how all the other
>> extensions work; most of them change syntax in some way or other
>> that breaks existing code.
>>
>>
>> In this case in the sense of avoiding splitting code into a new-Haskell
>> vs old-Haskell. This means that existing records should work well (and
>> ideally also get the improved name resolution when used in call sites
>> that have the pragma enabled) in the new record system.
>
> I understand that position, but it does impose some pretty big
> constraints, which may mean the design has to make some compromises.
> It's probably not worth discussing this tradeoff until there's actually
> a concrete proposal so that we can quantify how much old code would fail
> to compile and the cost of any compromises.
In this spirit, I've started to prepare a concrete proposal for a
revised OverloadedRecordFields design, based on recent feedback:
https://ghc.haskell.org/trac/ghc/wiki/Records/OverloadedRecordFields/Redesign
This would not necessarily include anonymous records at first, but they
do fit nicely as a potential later extension, and it would work well
with a slightly amended version of the record library in the meantime.
I'd be very interested to hear what you think of this.
Also, if someone would be prepared to flesh out a proposal based on the
anonymous records idea, that might be a useful point of comparison.
Adam
--
Adam Gundry, Haskell Consultant
Well-Typed LLP, http://www.well-typed.com/
More information about the ghc-devs
mailing list