
25 May
2017
25 May
'17
11:10 a.m.
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