Why does map return an additional element when using ranges in Haskell?
I've just started learning Haskell and found a strange thing. Let we have a list: ghci> [0,2..5] [0,2,4] It has 3 elements. When I use map with this list I get 3 element as output, for example: ghci> map (+ 1) [0,2..5] [1,3,5] ghci> map (* 2) [0,2..5] [0,4,8] ghci> map (`div` 2) [0,2..5] [0,1,2] But when I use fractional division I get 4 elements in output list: ghci> map (/ 2) [0,2..5] [0.0,1.0,2.0,3.0] ghci> length (map (/ 2) [0,2..5]) 4 Could you please explain why map may return more elements then it was? Thank you! It's due to the implementation of Enum for Float and Double : > [0,2..5] :