[Haskell-cafe] Prolog-style list syntax?

MigMit migmit at gmail.com
Mon Jun 28 11:26:38 UTC 2021


I did some work with Erlang, which uses Prolog-style syntax. I've always found this [H|T] to be confusing, since T is not an element of that list. But it could be because I've learned Haskell before Erlang.

> On 28 Jun 2021, at 13:09, Johannes Waldmann <johannes.waldmann at htwk-leipzig.de> wrote:
> 
>> `[ x, y, z | zs ]` is also valid; [...]
>> That structure is particularly ugly in Haskell syntax.
> 
> how so?  `x : y : z : zs`
> 
> Prolog list syntax is ugly here because
> the "cons" operator (|) needs special parentheses.
> 
> Well, a similar thing in Haskell ist the ".."
> (enumFromTo) operator.
> 
> For syntactic generality, you could go full Agda
> https://agda.readthedocs.io/en/v2.6.0.1/language/mixfix-operators.html
> but I'm not sure whether brackets could be "name parts"
> 
> - J.W.
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.



More information about the Haskell-Cafe mailing list