I'm new to Haskell. I try to make some exercice and one of this is to ask a number n
, then get n
and concatenate them. the prototype of the function is given by the exercise:
concatLines :: Int -> IO String
I tryied this/
concatLines n | n == 1 = getLine >>= \x -> return x
| otherwise = getLine >>= \x -> return $ (x ++ concatLines (n - 1))
But i got the following error:
DoOp.hs:63:64:
Couldn't match expected type \`[Char]\` with actual type \`IO String\`
In the return type of a call of \`concatLines\`
In the second argument of \`(++)\`, namely \`concatLines (n - 1)\`
In the second argument of \`($)\`, namely
(x ++ concatLines (n - 1))\`
I search for convert IO String
to [Char]
but without succes.