Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Look at those Huskell retards and laugh

Name: Anonymous 2014-12-13 9:12

However, this comes with the caveats of using WriterT [a], which is that it will leak space like crazy for a large assembly computation (even if you don't log anything!).

This is wrong.

*Main Control.Monad> take 2 . flip evalState 0 . execWriterT $ forever (byte 4)
[4,4]


Also, when complied with -O2 then

main = print . flip evalState 0 . execWriterT $ forever (byte 4)

appears to run in constant memory.

------------------------------------------

Huh. I guess that works because the whole stack is lazy. However, if you make the base State monad strict then WriterT leaks space:

>>> import Control.Monad.Trans.Writer
>>> import Control.Monad.Trans.State.Strict
>>> import Control.Monad.Trans.Class
>>> import Control.Monad
>>> runStateT (execWriterT (forever (lift (put 1)))) 0 -- Leaks space

Name: Anonymous 2014-12-23 19:33

More laughs from Haskell idiots:

Looking for a purely functional replacement for mutable vectors, but all are at least 100 times slower. Any alternative?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List