You can implement it using
traverse_ or the flipped argument versions:
for_. I prefer
for_ since it looks more like the “enhanced for-loop” from languages like Java.
import Data.Foldable (for_) myPutStr :: [(Double,String)] -> IO () myPutStr vals = do for_ vals $ \(num, str) -> do putStr str putStr ": " print (num * 1.15) -- increase num by 15% putStrLn "Done"
solved Haskell, tuple (double, string) [closed]