
#15031: [1,1..0] /= [1,1..2] -------------------------------------+------------------------------------- Reporter: sgraf | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.1 Component: libraries/base | Version: 8.2.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by sgraf): Ok, found it in section 6.3.4 of the Haskell2010 spec: https://www.haskell.org/onlinereport/haskell2010/haskellch6.html#dx13-131001
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.
Since the increment is in fact 0 and e3=0 < e1=1, this conforms to the standard. What an unfortunate assymetry. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15031#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler