What you really want is "replicateM_". But to answer your original question, you could do something like:
import Control.Monad.List
main = runListT $ do
_ <- ListT $ pure [1,2,3,4]
liftIO $ putStrLn "Test"
(replicateM_ is way better though)
Tom
El May 1, 2015, a las 10:23, Marcin Mrotek
It depends on what are you trying to achieve. The ListT monad transformer is an overkill for your example, as you don't use the "non-determinism" feature of ListT (code written using it can use whole lists of values as if it was one value with multiple "versions", any action can return any number of results, which are then combined together, perhaps without even calculating all of them if they're not needed); if you just want to sequence actions, it's enough to use mapM, mapM_, sequence, sequence_, and other functions from Control.Monad. But if you have something more complicated in mind, it might be worth taking a look at ListT and other transformers to see if they can be of any use to you.
Best regards, Marcin Mrotek _______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners