Haskell: Printing out the contents of a list of tuples -
Actually what I need to do is type a function that is in the [[string, string] type list and prints the content so that the line-by-line output looks like this:
first string: secondstrings first string: second string .., for each item in the list, I got the following code and it has been printed, but kiss Because of this [(), ()] is finally print a row.
Display :: Table - & gt; Io () display zs = do {xs & lt; - Sequence [putStrLn (a ++ "=" + + b). (A, B) & lt; - zs]; Is anything wrong?
The last print xs are unnecessary. The sequence is returning a group of S (putStrLn's return value) here, and printing is also printed.
When you are on that, now print X runs, you get rid of the XX variable and throw sequence sequence in order to throw the return value:
display :: table - & gt; IO () display zs = sequence_ [putStrLn (a ++ "=" ++ b). (A, B) & lt; - zs]
Comments
Post a Comment