RE: [Hugs-users] Record puns, time for removal?

| There was some discussion on the haskell' list about bring back | record puns, which were once in ghc. | | Record punning would have been very helpful on one of my recent | projects, where I had some large arrays of statically initialized | records. | The longFieldSelectorNamesToAvoidNamespaceClashes are just | noise is such a case. I always thought it was a mistake to remove record puns in H98. I would not be against re-introducing them into GHC, since they appear to remain in Hugs and are in Yhc. Simon

On Mon, Oct 30, 2006 at 12:11:23PM -0000, Simon Peyton-Jones wrote:
I always thought it was a mistake to remove record puns in H98. I would not be against re-introducing them into GHC, since they appear to remain in Hugs and are in Yhc.
yes. jhc has them too and I wish ghc did. puns like Foo { .. } would be great too. I made this page on the wiki to record fixes to the record system: http://haskell.galois.com/cgi-bin/haskell-prime/trac.cgi/wiki/ExistingRecord... most would be pretty straightforward to implement. John -- John Meacham - ⑆repetae.net⑆john⑈

On Mon, 30 Oct 2006 16:30:42 -0800
John Meacham
On Mon, Oct 30, 2006 at 12:11:23PM -0000, Simon Peyton-Jones wrote:
I always thought it was a mistake to remove record puns in H98. I would not be against re-introducing them into GHC, since they appear to remain in Hugs and are in Yhc.
yes. jhc has them too and I wish ghc did.
puns like Foo { .. } would be great too.
I'd vote for enabling them with a command line switch, rather than by default, as they can be confusing to folks learning the language. Seth
I made this page on the wiki to record fixes to the record system:
http://haskell.galois.com/cgi-bin/haskell-prime/trac.cgi/wiki/ExistingRecord...
most would be pretty straightforward to implement.
John
-- John Meacham - ⑆repetae.net⑆john⑈ _______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Hi
puns like Foo { .. } would be great too.
I'd vote for enabling them with a command line switch, rather than by default, as they can be confusing to folks learning the language.
How discussions come full circle :) I started this discussion on the Hugs users list because I want to _remove_ the command line switch for puns from Yhc. I'm not overly fussed whether I remove the entire feature, or just remove the command line and make it always on by default, but I do want the command line switch gone! Interestingly now there seems to be a sudden body of people coming out the woodwork who want this feature - so perhaps this should be sorted for Haskell'. Thanks Neil

Hello Neil, Tuesday, October 31, 2006, 4:04:23 AM, you wrote:
puns like Foo { .. } would be great too.
I'd vote for enabling them with a command line switch, rather than by default, as they can be confusing to folks learning the language.
How discussions come full circle :) I started this discussion on the Hugs users list because I want to _remove_ the command line switch for puns from Yhc. I'm not overly fussed whether I remove the entire feature, or just remove the command line and make it always on by default, but I do want the command line switch gone!
compiler switch can't be made a part of Haskell' :) and anyway, i don't see how cmdline switch may help noivices - when they use ".." by mistake and program mysteriously not fails? or when they stare at the other's program and understand that this unknown ".." work only because this program compiled with some special switch? and yes, record puns seems very ggod candidate for H'. it's widely used (i used it until switched to GHC), it was already in Haskell, and now it is impelemnted by every compiler wildcard puns is more discussible, but i personally need this feature -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

On Tue, 31 Oct 2006 13:59:45 +0300
Bulat Ziganshin
Hello Neil,
Tuesday, October 31, 2006, 4:04:23 AM, you wrote:
puns like Foo { .. } would be great too.
I'd vote for enabling them with a command line switch, rather than by default, as they can be confusing to folks learning the language.
How discussions come full circle :) I started this discussion on the Hugs users list because I want to _remove_ the command line switch for puns from Yhc. I'm not overly fussed whether I remove the entire feature, or just remove the command line and make it always on by default, but I do want the command line switch gone!
compiler switch can't be made a part of Haskell' :)
and anyway, i don't see how cmdline switch may help noivices - when they use ".." by mistake and program mysteriously not fails? or when they stare at the other's program and understand that this unknown ".." work only because this program compiled with some special switch?
I wasn't talking about the .., I was talking about the primary issue raised by the email, which has nothing to do with .. Instead of assuming that I was saying something totally useless and worthless, it might not be a bad idea to respond to _my_ email, not an email which contains a quote of one line from my email.
and yes, record puns seems very ggod candidate for H'. it's widely used (i used it until switched to GHC), it was already in Haskell, and now it is impelemnted by every compiler
wildcard puns is more discussible, but i personally need this feature
-- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

Hello, I think the "it may be confusing to novices" argument tends to be over-used and we should be careful before we make language decisions solely based on it. At the very least, when there is a suggestion that something might be confusing to someone, there should be an explanation of what/why/to whom it is confusing. I think record puns are a nice feature, it is easy to explain, and without them the Haskell record system is less useful, at least to me. By the way, if I recall correctly, in Johan Nordlander's O'Hugs the .. notation (called record packing, I think) could also be used to create record values. I think it worked like this:
data Point = Point { x,y :: Int } pt = let { x = 3; y = 4 } in Point { .. }
The ".." is expanded to "{x = x, y = y}" based on the fields for the
particular constructor. It seems that if we have the "Point { .. }"
pattern, we should also have the constructor version. What do people
think?
-Iavor
On 10/31/06, Seth Kurtzberg
On Tue, 31 Oct 2006 13:59:45 +0300 Bulat Ziganshin
wrote: Hello Neil,
Tuesday, October 31, 2006, 4:04:23 AM, you wrote:
puns like Foo { .. } would be great too.
I'd vote for enabling them with a command line switch, rather than by default, as they can be confusing to folks learning the language.
How discussions come full circle :) I started this discussion on the Hugs users list because I want to _remove_ the command line switch for puns from Yhc. I'm not overly fussed whether I remove the entire feature, or just remove the command line and make it always on by default, but I do want the command line switch gone!
compiler switch can't be made a part of Haskell' :)
and anyway, i don't see how cmdline switch may help noivices - when they use ".." by mistake and program mysteriously not fails? or when they stare at the other's program and understand that this unknown ".." work only because this program compiled with some special switch?
I wasn't talking about the .., I was talking about the primary issue raised by the email, which has nothing to do with ..
Instead of assuming that I was saying something totally useless and worthless, it might not be a bad idea to respond to _my_ email, not an email which contains a quote of one line from my email.
and yes, record puns seems very ggod candidate for H'. it's widely used (i used it until switched to GHC), it was already in Haskell, and now it is impelemnted by every compiler
wildcard puns is more discussible, but i personally need this feature
-- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

On Tue, 31 Oct 2006 11:06:01 -0800
"Iavor Diatchki"
Hello, I think the "it may be confusing to novices" argument tends to be over-used and we should be careful before we make language decisions solely based on it. At the very least, when there is a suggestion that something might be confusing to someone, there should be an explanation of what/why/to whom it is confusing.
I don't disagree at all. I'm not suggesting that the "confusion" issue should have any impact at all on decisions about the language. I was only talking about whether the pun feature should be accepted by default, or require an -fwhatever. I don't see this as being different than, say, -fglasgow-exts. Or, perhaps, it should simply be one of the glasgow extensions. As to why it might be confusing, I realize this is extremely subjective. Suppose you have a record type, and add a constructor to it. As things stand, I can use the compiler to be certain that I've found all areas of the code that require changes because of the addition of the constructor (with the flag that tells gcc to find non-exhaustive pattern matches). Using the compiler in this manner is (IMO) one of the things that makes refactering in Haskell so much easier than some other languages. OK, now, if the pun feature is on, it's no longer illegal to provide processing for only one constructor. (That's not the only thing it does, but that is one thing that it does.) Seth
I think record puns are a nice feature, it is easy to explain, and without them the Haskell record system is less useful, at least to me.
By the way, if I recall correctly, in Johan Nordlander's O'Hugs the .. notation (called record packing, I think) could also be used to create record values. I think it worked like this:
data Point = Point { x,y :: Int } pt = let { x = 3; y = 4 } in Point { .. }
The ".." is expanded to "{x = x, y = y}" based on the fields for the particular constructor. It seems that if we have the "Point { .. }" pattern, we should also have the constructor version. What do people think?
-Iavor
On 10/31/06, Seth Kurtzberg
wrote: On Tue, 31 Oct 2006 13:59:45 +0300 Bulat Ziganshin
wrote: Hello Neil,
Tuesday, October 31, 2006, 4:04:23 AM, you wrote:
puns like Foo { .. } would be great too.
I'd vote for enabling them with a command line switch, rather than by default, as they can be confusing to folks learning the language.
How discussions come full circle :) I started this discussion on the Hugs users list because I want to _remove_ the command line switch for puns from Yhc. I'm not overly fussed whether I remove the entire feature, or just remove the command line and make it always on by default, but I do want the command line switch gone!
compiler switch can't be made a part of Haskell' :)
and anyway, i don't see how cmdline switch may help noivices - when they use ".." by mistake and program mysteriously not fails? or when they stare at the other's program and understand that this unknown ".." work only because this program compiled with some special switch?
I wasn't talking about the .., I was talking about the primary issue raised by the email, which has nothing to do with ..
Instead of assuming that I was saying something totally useless and worthless, it might not be a bad idea to respond to _my_ email, not an email which contains a quote of one line from my email.
and yes, record puns seems very ggod candidate for H'. it's widely used (i used it until switched to GHC), it was already in Haskell, and now it is impelemnted by every compiler
wildcard puns is more discussible, but i personally need this feature
-- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

On Tue, Oct 31, 2006 at 02:42:58PM -0500, Seth Kurtzberg wrote:
As to why it might be confusing, I realize this is extremely subjective. Suppose you have a record type, and add a constructor to it. As things stand, I can use the compiler to be certain that I've found all areas of the code that require changes because of the addition of the constructor (with the flag that tells gcc to find non-exhaustive pattern matches). Using the compiler in this manner is (IMO) one of the things that makes refactering in Haskell so much easier than some other languages.
OK, now, if the pun feature is on, it's no longer illegal to provide processing for only one constructor. (That's not the only thing it does, but that is one thing that it does.)
I am not sure what you mean here data Foo = Foo { foo :: Int } f Foo { .. } = foo now if we change data Foo = Foo { foo :: Int } | Bar { bar :: Int } then f gets an incomplete pattern match warning. John -- John Meacham - ⑆repetae.net⑆john⑈

If we allow C{..} in patterns we should absolutely have it in expressions too. Both for symmetry and usefulness. -- Lennart On Oct 31, 2006, at 14:06 , Iavor Diatchki wrote:
Hello, I think the "it may be confusing to novices" argument tends to be over-used and we should be careful before we make language decisions solely based on it. At the very least, when there is a suggestion that something might be confusing to someone, there should be an explanation of what/why/to whom it is confusing.
I think record puns are a nice feature, it is easy to explain, and without them the Haskell record system is less useful, at least to me.
By the way, if I recall correctly, in Johan Nordlander's O'Hugs the .. notation (called record packing, I think) could also be used to create record values. I think it worked like this:
data Point = Point { x,y :: Int } pt = let { x = 3; y = 4 } in Point { .. }
The ".." is expanded to "{x = x, y = y}" based on the fields for the particular constructor. It seems that if we have the "Point { .. }" pattern, we should also have the constructor version. What do people think?
-Iavor
On 10/31/06, Seth Kurtzberg
wrote: On Tue, 31 Oct 2006 13:59:45 +0300 Bulat Ziganshin
wrote: Hello Neil,
Tuesday, October 31, 2006, 4:04:23 AM, you wrote:
puns like Foo { .. } would be great too.
I'd vote for enabling them with a command line switch, rather than by default, as they can be confusing to folks learning the language.
How discussions come full circle :) I started this discussion on the Hugs users list because I want to _remove_ the command line switch for puns from Yhc. I'm not overly fussed whether I remove the entire feature, or just remove the command line and make it always on by default, but I do want the command line switch gone!
compiler switch can't be made a part of Haskell' :)
and anyway, i don't see how cmdline switch may help noivices - when they use ".." by mistake and program mysteriously not fails? or when they stare at the other's program and understand that this unknown ".." work only because this program compiled with some special switch?
I wasn't talking about the .., I was talking about the primary issue raised by the email, which has nothing to do with ..
Instead of assuming that I was saying something totally useless and worthless, it might not be a bad idea to respond to _my_ email, not an email which contains a quote of one line from my email.
and yes, record puns seems very ggod candidate for H'. it's widely used (i used it until switched to GHC), it was already in
Haskell, and
now it is impelemnted by every compiler
wildcard puns is more discussible, but i personally need this feature
-- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Hello Iavor, Tuesday, October 31, 2006, 10:06:01 PM, you wrote:
By the way, if I recall correctly, in Johan Nordlander's O'Hugs the .. notation (called record packing, I think) could also be used to create record values. I think it worked like this:
data Point = Point { x,y :: Int } pt = let { x = 3; y = 4 } in Point { .. }
The ".." is expanded to "{x = x, y = y}" based on the fields for the particular constructor. It seems that if we have the "Point { .. }" pattern, we should also have the constructor version. What do people think?
yes, yes, yes! definitely! i'll just show my code: parseCmdline cmdline = do ..... return$ Just$ Command { cmd_name = cmd , cmd_arcspec = arcspec , cmd_arclist = error "Using uninitialized cmd_arclist" , cmd_arcname = error "Using uninitialized cmd_arcname" , cmd_arc_filter = const True , cmd_filespecs = filespecs , cmd_added_arcnames = return [] , cmd_diskfiles = return [] , cmd_subcommand = False , opt_scan_subdirs = scan_subdirs , opt_add_dir = add_dir , opt_arc_basedir = arc_basedir , opt_disk_basedir = disk_basedir , opt_group_dir = group_dir , opt_group_data = group_data , opt_data_compressor = data_compressor , opt_dir_compressor = dir_compressor , opt_include_dirs = include_dirs , opt_indicator = indicator , opt_overwrite = overwrite , opt_keep_time = keep_time , opt_time_to_last = time_to_last , opt_test = test_files , opt_keep_broken = keep_broken , opt_match_with = match_with , opt_append = append , opt_recompress = recompress , opt_noarcext = noarcext , opt_nodir = nodir , opt_debug = debug , opt_cache = cache , opt_update_type = update_type , opt_x_include_dirs = x_include_dirs , opt_match_excluded = match_excluded , opt_sort_order = sort_order , opt_find_group = find_group . fiFilteredName , opt_groups_count = length group_strings , opt_find_type = find_type . fiFilteredName , opt_types_count = maximum group_types + 1 , opt_arccmt_file = arccmt_file , opt_lock_archive = lock_archive , opt_sfx = sfx , ref_ask_overwrite = ref_ask_overwrite } -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com
participants (7)
-
Bulat Ziganshin
-
Iavor Diatchki
-
John Meacham
-
Lennart Augustsson
-
Neil Mitchell
-
Seth Kurtzberg
-
Simon Peyton-Jones