Talk:Haskell/Syntactic sugar

From Wikibooks, the open-content textbooks collection

Jump to: navigation, search

The unsugared version of the list stuff are sort of incorrect.

[1..] is in fact sweet for enumFrom 1 [1,3..] is sweet for enumFromThen 1 3 [1..10] is sweet for enumFromTo 1 10 [1,3..9] is sweet for enumFromThenTo 1 3 9

Those constructs using iterate are flat out wrong. The range sugar works for any instance of Enum, and those constructs fully don't explain why you can do things like

[LT ..] ==> [LT, EQ, GT]

I just made this change.

-kalmar