<div dir="auto">I'd definitely be against what you propose; as you pointed out it introduces a syntax ambiguity, which I think should be avoided where possible.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, 28 Jun 2021, 4:19 pm Anthony Clayden, <<a href="mailto:anthony.d.clayden@gmail.com">anthony.d.clayden@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_quote"><div dir="ltr">One of the annoying (to me) inconsistencies with Haskell syntax is that `[  ]` means 'here comes a list'; but for the most common way to write a list, you can't use `[  ]`:<div><br></div><div>>    elem x []        = False</div><div>>    elem x ( y: ys ) = ...</div><div><br></div><div>Prolog syntax has lists, signalled by `[   ]`: [], [1], [2, 3], [4, 5, 6], [[7, 8], [9, 10, 11]] are all valid list literals. For cons it also uses `[   ]` syntax</div><div><br></div><div>>    elem x [y | ys ] = ...</div><div><br></div><div>`[ x, y, z | zs ]` is also valid; pattern match or build a list with at least 3 elements, where `zs` is the tail -- 4th element onwards (if any). That structure is particularly ugly in Haskell syntax.</div><div><br></div><div>Neither `|` inside `[   ]` in a pattern nor a comma-list with `|` inside `[   ]` is valid H98 syntax, nor valid in GHC extensions AFAICT.</div><div><br></div><div>In an expression, `[ x | xs ]` could be taken as a list comprehension, which is I guess why Haskell didn't follow Prolog. I've come across another theorem-prover that follows Prolog style, except it uses `:` instead of `|` inside `[   ]`. Unfortunately ...</div><div><br></div><div>>    elem x [ y: ys ] = ...</div><div><br></div><div>Is valid syntax, where `:` is cons, so this is a nested list. I'm thinking that's relatively uncommon, and means the same as `[ ( y: ys ) ]`. </div><div><br></div><div>Would anyone be violently pro or anti changing the meaning of `:` appearing at top level in `[   ]` to mean cons-tail?</div><div><br></div><div>AntC</div></div>
</div></div>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
To (un)subscribe, modify options or view archives go to:<br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
Only members subscribed via the mailman list are allowed to post.</blockquote></div>