IO operations, part of the Useful module.
- replicateM :: Monad m => Int -> m a -> m [a]
- replicateM_ :: Monad m => Int -> m a -> m ()
- foreach :: Monad m => [a] -> (a -> m b) -> m ()
- while :: Monad m => m Bool -> m a -> m ()
- put :: Show a => a -> IO ()
- write :: Show a => a -> IO ()
- writeln :: Show a => a -> IO ()
- putln :: Show a => a -> IO ()
- mapM_2 :: Monad m => (a -> m b) -> [[a]] -> m ()
- rand :: [a] -> IO a
repeats an IO function for every member of a list, using the list item as an arguement
$ do foreach [1..3] print 1 2 3 $ do foreach "asjkdnsd" putChar asjkdnsd
repeats an IO function until a IO Bool is true
NOTE: Be careful with this function! Better to use recursion. Testing against an item created in the loop will not work.
like putStr or putChar but works on any type with "show" defined in a similar way to how print does. Can be thought of as "print" without the trailing linebreak.
NOTE: This means it will print strings with quotes around them. To print strings without quotes use putStr or putStrLn