[Haskell-beginners] Queues in Haskell

rohan sumant r.s.sumant at gmail.com
Wed Apr 6 05:33:20 UTC 2016


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20160406/83db5c81/attachment.html>


More information about the Beginners mailing list