
6 Apr
2016
6 Apr
'16
1:33 a.m.
Hello, According to http://rafal.io/posts/haskell-queues.html (++) cant be used to implement queues in Haskell. The reason being that a push operation takes linear time which is indeed very valid given that (++) operates in linear time. However, since Haskell is lazy shouldn't (++) be implemented only when the need occurs? In head ([1..] ++ [10]) I sincerely doubt the the [10] is concatenated before evaluating the head of the list. Please note that this question is focused upon the internals of Haskell. I am aware that there are other approaches to implementing queues in Haskell. Rohan Sumant