
В Thu, 25 May 2017 17:43:49 +0200
Francesco Ariis
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)
Yes! And this is the source of my questions.. 1) How to call it? 2) What does mean to provide argument of type ".. Writer .."? As result, it's good: you can run it with "runWriter", but what is "writer" in input argument? Fake writer (which is ignoring)?
_______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners