what about moving the record system to an addendum?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

what about moving the record system to an addendum?

Samuel Bronson
According to <http://hackage.haskell.org/trac/haskell-prime/wiki/Status>,
ticket #99 was rejected, but the tickets own page,
<http://hackage.haskell.org/trac/haskell-prime/ticket/99>, says
"probably yes". Which is it?

I was about to propose this myself, but decided to check the trac just
in case it had already been proposed, Haskell being so popular with
smart people and all, and was at first rather disappointed and ready
to write an angry rant to the list, then rather confused when I
noticed the ticket's page said almost the exact opposite of the Status
page.

In particular, I want records to be considered an extension to
Haskell', to be implemented only by compilers that care, and even then
only allowed with a LANGUAGE pragma like this:

   {-# LANGUAGE TraditionalRecordSyntax #-}

For pre-Haskell' compilers, we would want something like:

   {-# LANGUAGE NoTraditionalRecordSyntax #-}

which would mean extending the LANGUAGE pragma to support turning
extensions off by adding/removing a No from the front of it.

Hmm, is it really the case that nobody has proposed LANGUAGE pragmas for
Haskell'? I don't see them listed on the Status page.

I guess the work involved here is basically:

(a) Go through Haskell 98, find all the parts that talk specifically
about record syntax, and write up the list of such places.

(b) Implement this in GHC:
  <http://hackage.haskell.org/trac/ghc/ticket/3356>

(c) Add support for negating extension names by adding/removing No in
front of extension names to Cabal:
  <http://hackage.haskell.org/trac/hackage/ticket/567>

(d) Add {-# LANGUAGE #-} to Haskell'

What do you folks think?
_______________________________________________
Haskell-prime mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-prime
Reply | Threaded
Open this post in threaded view
|

Re: what about moving the record system to an addendum?

Duncan Coutts
On Mon, 2009-07-06 at 17:30 -0400, Samuel Bronson wrote:

> According to <http://hackage.haskell.org/trac/haskell-prime/wiki/Status>,
> ticket #99 was rejected, but the tickets own page,
> <http://hackage.haskell.org/trac/haskell-prime/ticket/99>, says
> "probably yes". Which is it?
>
> I was about to propose this myself, but decided to check the trac just
> in case it had already been proposed, Haskell being so popular with
> smart people and all, and was at first rather disappointed and ready
> to write an angry rant to the list, then rather confused when I
> noticed the ticket's page said almost the exact opposite of the Status
> page.
>
> In particular, I want records to be considered an extension to
> Haskell', to be implemented only by compilers that care, and even then
> only allowed with a LANGUAGE pragma like this:
>
>    {-# LANGUAGE TraditionalRecordSyntax #-}
>
> For pre-Haskell' compilers, we would want something like:
>
>    {-# LANGUAGE NoTraditionalRecordSyntax #-}
>
> which would mean extending the LANGUAGE pragma to support turning
> extensions off by adding/removing a No from the front of it.

The motivation I suppose is so that people can experiment with other
record systems as extensions without having to worry so much about the
syntax clashing with the existing syntax.

It would have to be clear that it may not be possible to use certain
combinations of extensions together. In particular
TraditionalRecordSyntax with some future alternative record extension.

> Hmm, is it really the case that nobody has proposed LANGUAGE pragmas for
> Haskell'? I don't see them listed on the Status page.

This we certainly need to do. It's the primary mechanism by which we
allow flexibility in the language without breaking all existing code (by
letting modules declare which language features they want to turn on or
off).

For one thing the spec currently says that pragmas cannot change the
semantics of the program. That would have to read "apart from the
LANGUAGE pragma".

Duncan

_______________________________________________
Haskell-prime mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-prime
Reply | Threaded
Open this post in threaded view
|

Re: what about moving the record system to an addendum?

John Meacham
In reply to this post by Samuel Bronson
Well, without a replacement, it seems odd to remove it. Also, Haskell
currently doesn't _have_ a record syntax (I think it was always a
misnomer to call it that) it has 'labeled fields'. None of the proposed
record syntaxes fit the same niche as labeled fields so I don't see them
going away even if a record syntax is added to haskell in the future. I
would like to see the simple modifications to the record syntax listed
on this page though

http://hackage.haskell.org/trac/haskell-prime/wiki/ExistingRecords

and a reworking of the standard to not refer to the current system as a
'record syntax' but rather a 'labeled fields' syntax.

        John

--
John Meacham - ⑆repetae.net⑆john⑈ - http://notanumber.net/
_______________________________________________
Haskell-prime mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-prime
Reply | Threaded
Open this post in threaded view
|

Re: what about moving the record system to an addendum?

Duncan Coutts
On Mon, 2009-07-06 at 18:28 -0700, John Meacham wrote:
> Well, without a replacement, it seems odd to remove it. Also, Haskell
> currently doesn't _have_ a record syntax (I think it was always a
> misnomer to call it that) it has 'labeled fields'. None of the proposed
> record syntaxes fit the same niche as labeled fields so I don't see them
> going away even if a record syntax is added to haskell in the future.

The people proposing this can correct me if I'm wrong but my
understanding of their motivation is not to remove record syntax or
immediately to replace it, but to make it easier to experiment with
replacements by making the existing labelled fields syntax a modular
part of the language that can be turned on or off (like the FFI).

I'm not sure that I agree that it's the best approach but it is one idea
to try and break the current impasse. It seems currently we cannot
experiment with new record systems because they inevitably clash with
the current labelled fields and thus nothing changes.

Duncan

_______________________________________________
Haskell-prime mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-prime
Reply | Threaded
Open this post in threaded view
|

Re: what about moving the record system to an addendum?

Malcolm Wallace
In reply to this post by John Meacham

On 7 Jul 2009, at 02:28, John Meacham wrote:

> Haskell currently doesn't _have_ a record syntax (I think it was  
> always a
> misnomer to call it that) it has 'labeled fields'. ...
>
> and a reworking of the standard to not refer to the current system  
> as a
> 'record syntax' but rather a 'labeled fields' syntax.

I strongly agree with the latter.  In fact, I was under the impression  
that the Report already avoided the term "record syntax" completely,  
but checking just now showed 6 distinct occurrences.

Regards,
     Malcolm

_______________________________________________
Haskell-prime mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-prime
Reply | Threaded
Open this post in threaded view
|

Re[2]: what about moving the record system to an addendum?

Bulat Ziganshin-2
In reply to this post by Duncan Coutts
Hello Duncan,

Tuesday, July 7, 2009, 2:15:42 AM, you wrote:

> For one thing the spec currently says that pragmas cannot change the
> semantics of the program. That would have to read "apart from the
> LANGUAGE pragma".

sometime ago i've proposed to make a "language" statement a part of
haskell. i don't insist on this but at least keep this possibility in
mind - making it a pragma is a poor man solution


--
Best regards,
 Bulat                            mailto:[hidden email]

_______________________________________________
Haskell-prime mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-prime
Reply | Threaded
Open this post in threaded view
|

Re: what about moving the record system to an addendum?

Isaac Dupree-3
In reply to this post by Malcolm Wallace
Malcolm Wallace wrote:

>
> On 7 Jul 2009, at 02:28, John Meacham wrote:
>
>> Haskell currently doesn't _have_ a record syntax (I think it was always a
>> misnomer to call it that) it has 'labeled fields'. ...
>>
>> and a reworking of the standard to not refer to the current system as a
>> 'record syntax' but rather a 'labeled fields' syntax.
>
> I strongly agree with the latter.  In fact, I was under the impression
> that the Report already avoided the term "record syntax" completely, but
> checking just now showed 6 distinct occurrences.

ah hah.  Existing extension names:
NamedFieldPuns (was erroneously "RecordPuns" in GHC for a release)
RecordWildCards, DisambiguateRecordFields

this "extension" could be named NamedFields.
(then giving the lie to the above new names which maybe ought to be more
like FieldWildCards and DisambiguateNamedFields(DisambiguateFieldNames?))

Also there is "ExtensibleRecords" which I guess refers to Hugs' TRex?

-Isaac
_______________________________________________
Haskell-prime mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-prime
Reply | Threaded
Open this post in threaded view
|

Re: Re[2]: what about moving the record system to an addendum?

Ravi Nanavati
In reply to this post by Bulat Ziganshin-2
I've suggested some sort of standardization of the LANGUAGE pragma as
well. Given our new modular, yearly approach to standardization, it
does seem worth trying to formalize it.

 - Ravi

On Tue, Jul 7, 2009 at 7:12 AM, Bulat
Ziganshin<[hidden email]> wrote:

> Hello Duncan,
>
> Tuesday, July 7, 2009, 2:15:42 AM, you wrote:
>
>> For one thing the spec currently says that pragmas cannot change the
>> semantics of the program. That would have to read "apart from the
>> LANGUAGE pragma".
>
> sometime ago i've proposed to make a "language" statement a part of
> haskell. i don't insist on this but at least keep this possibility in
> mind - making it a pragma is a poor man solution
>
>
> --
> Best regards,
>  Bulat                            mailto:[hidden email]
>
> _______________________________________________
> Haskell-prime mailing list
> [hidden email]
> http://www.haskell.org/mailman/listinfo/haskell-prime
>
_______________________________________________
Haskell-prime mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-prime
Reply | Threaded
Open this post in threaded view
|

Re: what about moving the record system to an addendum?

Ravi Nanavati
In reply to this post by Duncan Coutts
2009/7/7 Duncan Coutts <[hidden email]>:

> On Mon, 2009-07-06 at 18:28 -0700, John Meacham wrote:
>> Well, without a replacement, it seems odd to remove it. Also, Haskell
>> currently doesn't _have_ a record syntax (I think it was always a
>> misnomer to call it that) it has 'labeled fields'. None of the proposed
>> record syntaxes fit the same niche as labeled fields so I don't see them
>> going away even if a record syntax is added to haskell in the future.
>
> The people proposing this can correct me if I'm wrong but my
> understanding of their motivation is not to remove record syntax or
> immediately to replace it, but to make it easier to experiment with
> replacements by making the existing labelled fields syntax a modular
> part of the language that can be turned on or off (like the FFI).
>
> I'm not sure that I agree that it's the best approach but it is one idea
> to try and break the current impasse. It seems currently we cannot
> experiment with new record systems because they inevitably clash with
> the current labelled fields and thus nothing changes.

I think it is a powerful approach to try and break the current impasse
for the following reasons:

1. Once implemented, Hackage and Cabal will soon give us accurate data
on what publicly available Haskell code does and does not depend on
NamedFields/TraditionalRecordSyntax/WhateverWeEndUpCallingIt
2. Once deprecated, people will be encouraged to not depend on the
traditional record syntax where the cost of avoiding it is small (I'm
thinking of situations like the mtl-accessors / run functions where
the traditional syntax is saving something like one function
definition).
3. Champions of alternative record syntaxes will know what on Hackage
they can use out-of-the-box and what things they'd want to consider
re-writing as examples of how their approach is superior.

Does anyone have a concrete dea of what it would take to carve out the
existing syntax as an addendum?

Thanks,

 - Ravi
_______________________________________________
Haskell-prime mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-prime
Reply | Threaded
Open this post in threaded view
|

Re: what about moving the record system to an addendum?

Iavor Diatchki
Hello,
I do not think that we should remove the current record/named fields
syntax, at least for the moment.  I use it a lot, and I do not want to
add extra pragmas or "extensions" to my cabal file.  In fact, one of
the purposes of Haskell', the way I understand it, is exactly to just
choose a stable set of extensions and give a name to them (so
decrease, not increase the number of pragmas).  I think that a new
reocrd/label system is way beyond the scope of Haskell'.  If people
want to experiment with new record systems they may already do so, by
defining a new extension.  A case in point is the Trex record system,
which is implemented in Hugs.
-Iavor

2009/7/7 Ravi Nanavati <[hidden email]>:

> 2009/7/7 Duncan Coutts <[hidden email]>:
>> On Mon, 2009-07-06 at 18:28 -0700, John Meacham wrote:
>>> Well, without a replacement, it seems odd to remove it. Also, Haskell
>>> currently doesn't _have_ a record syntax (I think it was always a
>>> misnomer to call it that) it has 'labeled fields'. None of the proposed
>>> record syntaxes fit the same niche as labeled fields so I don't see them
>>> going away even if a record syntax is added to haskell in the future.
>>
>> The people proposing this can correct me if I'm wrong but my
>> understanding of their motivation is not to remove record syntax or
>> immediately to replace it, but to make it easier to experiment with
>> replacements by making the existing labelled fields syntax a modular
>> part of the language that can be turned on or off (like the FFI).
>>
>> I'm not sure that I agree that it's the best approach but it is one idea
>> to try and break the current impasse. It seems currently we cannot
>> experiment with new record systems because they inevitably clash with
>> the current labelled fields and thus nothing changes.
>
> I think it is a powerful approach to try and break the current impasse
> for the following reasons:
>
> 1. Once implemented, Hackage and Cabal will soon give us accurate data
> on what publicly available Haskell code does and does not depend on
> NamedFields/TraditionalRecordSyntax/WhateverWeEndUpCallingIt
> 2. Once deprecated, people will be encouraged to not depend on the
> traditional record syntax where the cost of avoiding it is small (I'm
> thinking of situations like the mtl-accessors / run functions where
> the traditional syntax is saving something like one function
> definition).
> 3. Champions of alternative record syntaxes will know what on Hackage
> they can use out-of-the-box and what things they'd want to consider
> re-writing as examples of how their approach is superior.
>
> Does anyone have a concrete dea of what it would take to carve out the
> existing syntax as an addendum?
>
> Thanks,
>
>  - Ravi
> _______________________________________________
> Haskell-prime mailing list
> [hidden email]
> http://www.haskell.org/mailman/listinfo/haskell-prime
>
_______________________________________________
Haskell-prime mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-prime
Reply | Threaded
Open this post in threaded view
|

Re: what about moving the record system to an addendum?

John Meacham
In reply to this post by Ravi Nanavati
On Tue, Jul 07, 2009 at 10:28:11AM -0400, Ravi Nanavati wrote:
> 2. Once deprecated, people will be encouraged to not depend on the
> traditional record syntax where the cost of avoiding it is small (I'm
> thinking of situations like the mtl-accessors / run functions where
> the traditional syntax is saving something like one function
> definition).
> 3. Champions of alternative record syntaxes will know what on Hackage
> they can use out-of-the-box and what things they'd want to consider
> re-writing as examples of how their approach is superior.


Well, that's the problem. I don't want to ever deprecate the named field
mechanism as it is completely independent of a record system. You can
think of the possibilites as follows.


            named             positional

declared   LabeledFields      DataDeclarations

anonymous  ????               Tuples


So, a record syntax fills the hole of anonymous, named field types.
However, we shouldn't do it at the expense of opening another hole with
declared, named field types any more than we should dispose of standard
data declations in favor of making everything newtypes of tuples.


Also, this supports the idea of using parethensis rather than braces for
a record mechanism. this would be consistent with tuples in that parens
= anonymous. Also, if you just replace braces with parens in the scoped
records paper, you get no conflicts with existing syntax. (including
named fields) :)


        John



--
John Meacham - ⑆repetae.net⑆john⑈ - http://notanumber.net/
_______________________________________________
Haskell-prime mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-prime