
Are cool kids supposed to put the comma in front like this? , foo , bar , baz Is this for historical or other reasons because Emacs formats Haskell code well enough regardless. Thanks, Joel -- http://wagerlabs.com/

Hi,
Are cool kids supposed to put the comma in front like this? Some cool kids do, some cool kids don't. Some do both, depending on their mood.
The advantage of a leading , is that now the comma's line up, and if you want to add an item on the end of a list [a ,b ,c ] It's just a one line change, whereas with the comma after, you'd have to change the previous line as well - which is more effort and gives more noise in the darcs copy. Thanks Neil

On 2006-07-13 at 02:29BST "Neil Mitchell" wrote:
Hi,
Are cool kids supposed to put the comma in front like this? Some cool kids do, some cool kids don't. Some do both, depending on their mood.
The advantage of a leading , is that now the comma's line up, and if you want to add an item on the end of a list
[a ,b ,c ]
It's just a one line change, whereas with the comma after, you'd have to change the previous line as well - which is more effort and gives more noise in the darcs copy.
This is one of my pet hates. First, people find things easier to read if they are in a form that they have encountered lots of times before (in addition to psycho-visual factors). I'd like to think that Haskell programmers read a lot of literature (and since they should have started reading this long before they learnt to programme, and continue so to read, they're going to have read more literature than code). So for me (and anyone else moderately literate) a list written [a, b, c ] is easier to read and, (for folk who read from left to right) gives emphasis to the important parts rather than the punctuation. (Of course, a list with elements that short would just be written [a, b, c] anyway.) Now, you argue that it's more effort to add (or delete) items from lists in this form, and maybe you are right (I do it by dragging my mouse over stuff I want to remove, so start with the comma and go down; it doesn't seem too hard. If you want keystroke commands, you want something that respects the syntax). The thing is, making modifications that change the meaning /ought/ to be effortful. If you can delete things without thinking about it, you're probably going to delete something you shouldn't. Then the argument from darcs -- well, historically diff is line based, which was fine in the days of punch-cards, but makes much less sense nowadays. Ideally the diff darcs uses should be syntax driven -- a nice project for someone; we can save effort by only doing this for Haskell, and leave programmers in other languages stuck with line-by-line diffs. Jón -- Jón Fairbairn Jon.Fairbairn at cl.cam.ac.uk

On Thu, 13 Jul 2006, Jon Fairbairn wrote:
On 2006-07-13 at 02:29BST "Neil Mitchell" wrote:
Hi,
Are cool kids supposed to put the comma in front like this? Some cool kids do, some cool kids don't. Some do both, depending on their mood.
The advantage of a leading , is that now the comma's line up, and if you want to add an item on the end of a list
[a ,b ,c ]
It's just a one line change, whereas with the comma after, you'd have to change the previous line as well - which is more effort and gives more noise in the darcs copy.
This is one of my pet hates. First, people find things easier to read if they are in a form that they have encountered lots of times before (in addition to psycho-visual factors). I'd like to think that Haskell programmers read a lot of literature (and since they should have started reading this long before they learnt to programme, and continue so to read, they're going to have read more literature than code). So for me (and anyone else moderately literate) a list written
[a, b, c ]
Optimal notation of lists, because of most easiest editing, is a: b: c: [] =B-]

On 2006-07-13 at 11:15+0200 Henning Thielemann wrote:
Optimal notation of lists, because of most easiest editing, is
a: b: c: []
That made me smile. In Ponder I had used up : for types, and lists could be a:: b:: c:. but when I suggested this at a Haskell meeting, Simon PJ complained that it "looks like hopscotch". I've never quite understood that complaint! Jón -- Jón Fairbairn Jon.Fairbairn at cl.cam.ac.uk

Jon Fairbairn
a:: b:: c:.
but when I suggested this at a Haskell meeting, Simon PJ complained that it "looks like hopscotch". I've never quite understood that complaint!
http://blogs.salon.com/0002296/myimages/hopscotch.jpg and http://www.northshield.org/officers/seneschal/moy/games/hopscotch.gif suggest to me that the pattern of : and . going up in a row is a bit like the squares along the linear 'course' (or list (-:) where sometimes you get one and sometimes two. -- Mark

On 2006-07-13 at 09:35EDT mark@ixod.org (Mark T.B. Carroll) wrote:
Jon Fairbairn
writes: a:: b:: c:.
but when I suggested this at a Haskell meeting, Simon PJ complained that it "looks like hopscotch". I've never quite understood that complaint!
http://blogs.salon.com/0002296/myimages/hopscotch.jpg and http://www.northshield.org/officers/seneschal/moy/games/hopscotch.gif suggest to me that the pattern of : and . going up in a row is a bit like the squares along the linear 'course' (or list (-:) where sometimes you get one and sometimes two.
Well, perhaps (the pattern I associate with hopscotch is the first, ie ·:·:·:·, which could never happen since :. is the end of the list), but that still leaves open the question "What's bad about that?" :-) Jón -- Jón Fairbairn Jon.Fairbairn at cl.cam.ac.uk

On Jul 12, 2006, at 9:18 PM, Joel Reymont wrote:
Are cool kids supposed to put the comma in front like this?
, foo , bar , baz
Is this for historical or other reasons because Emacs formats Haskell code well enough regardless.
Thanks, Joel
I personally like this style. It's a little hard to say why, but let me attempt. I think it's related to layout. Layout trained me to regard the end of lines as uninteresting, and the beginning as interesting. Thus, I forget to put separators at the ends of lines (freedom from the tyranny of the semicolon!), but I always notice if a comma or semicolon is missing at the beginning of a line. Its very obvious because they're all aligned vertically and, as I said, Haskell trains you to notice the leading edges of lines if you use layout. It also makes it very visually obvious where the list/tuple/ do block ends when you line up the brackets with the separators. IMO the patch/diff/darcs issue is a red herring. It sounds like an after the fact justification to me. Rob Dockins Speak softly and drive a Sherman tank. Laugh hard; it's a long way to the bank. -- TMBG
participants (6)
-
Henning Thielemann
-
Joel Reymont
-
Jon Fairbairn
-
mark@ixod.org
-
Neil Mitchell
-
Robert Dockins