[Haskell-beginners] ListT + Writer
Baa
aquagnu at gmail.com
Thu May 25 15:10:27 UTC 2017
Hello, everybody!
I can process list in monad style with "do" syntax and to use "guard"
function in the body. Something like:
fn :: [a] -> [a]
fn lst = do
el <- lst
guard $ condition el
...
return $ change el
How can I do the same but with possibility to call "tell" of "Write"
monad in the fn's body? As I understand it should be:
ListT (Writer w) Int
for this example?
- but how to write it?
- how to call (run) it?
- and how is it safe ("transformers" package has bug in ListT, so "mtl"
must be used?)?
- is there other canonical way to do it without to use fold*, recursive
calls/fix, State/RWS ?
/Cheers
More information about the Beginners
mailing list