How is the sequence of syntactic sugar ([1..6]) translated into the syntax of the actual list (1: 2: 3 ... 6)?

How does Haskell translate [ and ] into list definitions? Are they value constructors or something else? Are they new? Is there a way to define outfix syntax rather than infix?

+6
source share
1 answer

This syntax is defined in Report , and in particular in section 3.10 . [1..6] is defined as enumFromTo 1 6 . You cannot define the syntax yourself.

+14
source

Source: https://habr.com/ru/post/950321/


All Articles