سؤال

How does Haskell translate [ and ] into the list definitions? Are they value constructors or something? Are they newtypes? Is there a way to define an outfix syntax, as opposed to an infix one?

هل كانت مفيدة؟

المحلول

This syntax is defined in the Report, and in particular in section 3.10. [1..6] is defined to mean enumFromTo 1 6. You can't define syntax like that yourself.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top