John Wicket wrote:
I am still in an imperative way of thinking. In this example here; how
would I call "putStrLn" and then set the function with a value. Eg:
aa :: String -> IO ()
aa instr = do
putStrLn "abc"
putStrLn "abc"
return "123"
--- The error I am getting.
Couldn't match expected type `()' against inferred type `[Char]'
In the first argument of `return', namely `"123"'
In the expression: return "123"
In the expression:
do putStrLn "abc"
putStrLn "abc"
return "123"
Your type signature is wrong. If you want an IO action whose return
value is a String, say so:
aa :: String -> IO String
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe