
On Thu, Mar 17, 2016 at 03:58:06AM +0100, Krisztian Pinter wrote:
Hello,
I noticed some odd behaviour with list comprehensions.
[1..1] == [1] BUT [1,1..1] == [1..]
Hello Krisztian, from the Haskell report (enumFromThenTo is longhand for [a,b..c] notation) [1]: The sequence enumFromThenTo e1 e2 e3 is the list [e1,e1+i,e1+2i,...e3], where the increment, i, is e2-e1. If the increment is positive or zero, the list terminates when the next element would be greater than e3; the list is empty if e1 > e3. If the increment is negative, the list terminates when the next element would be less than e3; the list is empty if e1 < e3. The important bit being "the list terminates when the next element would be greater than e3". Unfortunate in my opinion (I agree with you the fact that `[1..1] /= [1,1..1]` is puzzling), but specs compliant -F [1] https://www.haskell.org/onlinereport/basic.html