I have a list of type [Int]
which can only contain two values: 0
or 1
.
Example : [0, 0, 1, 1, 0, 0]
I would like to iterate through this list and when the current element is a 0, print '_'
and if it is a 1 print '*'
.
For the previous list, here is the result on the standard output :
__**__
I think that I have to do something like that :
displayLine :: [Int] -> IO [Int]
displayLine (0 : xs) =
do
print '_'
-- next char
displayLine (1 : xs) =
do
print '*'
-- next char
How can I display a character and continue recursion with the next character?