Below is the code:
Prelude> :t putStrLn putStrLn :: String -> IO () Prelude> putStrLn "test" test it :: () Prelude> putStrLn "test" ++ "test" <interactive>:25:1: Couldn't match expected type '[Char]' with actual type 'IO ()' In the first argument of '(++)', namely 'putStrLn "test"' In the expression: putStrLn "test" ++ "test" Prelude> :t "test" "test" :: [Char] Prelude> :t "test" ++ "test" "test" ++ "test" :: [Char] Prelude>
I do not understand the error:
" Couldn't match expected type '[Char]' with actual type 'IO ()' In the first argument of '(++)', namely 'putStrLn "test"' In the expression: putStrLn "test" ++ "test""
How putStrLn takes type [Char] as the first parameter (I assume it is implicitly converted to String?). But this does not set the test if "test" ++ "test" is passed as a parameter, although "test" ++ "test" is of type [Char] as well?
source share