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-13 12:50

You could just get shit done F#.NET (might even get you a job, in finance even).

http://fsharp.org/use/linux/

Or keep using haskell because you read it was cool on Reddit or Hackernews or some shit.

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