[Haskell-cafe] Prolog-style list syntax?

Hécate hecate at glitchbra.in
Mon Jun 28 11:31:02 UTC 2021


Having learned Erlang before Haskell, I recall having the opposite 
opinion at first. ;)

Le 28/06/2021 à 13:26, MigMit a écrit :
> 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.
> _______________________________________________
> 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.

-- 
Hécate ✨
🐦: @TechnoEmpress
IRC: Hecate
WWW: https://glitchbra.in
RUN: BSD



More information about the Haskell-Cafe mailing list