
25 May
2017
25 May
'17
11:43 a.m.
On Thu, May 25, 2017 at 06:10:27PM +0300, Baa wrote:
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:
Should be as easy as: import Control.Monad.List import Control.Monad.Writer type Prova = ListT (Writer String) Int fn :: Prova -> Prova fn lst = do el <- lst guard (rem el 2 == 0) lift $ tell "hey bby" return (el + 1)