Created
January 13, 2014 20:50
-
-
Save novodinia/8407886 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- foo1.hs | |
main = do | |
a <- readFile "bar.txt" | |
b <- lines a | |
return putStrLn b | |
{- | |
foo1.hs:3:8: | |
Couldn't match type `[]' with `IO' | |
Expected type: IO String | |
Actual type: [String] | |
In the return type of a call of `lines' | |
In a stmt of a 'do' block: b <- lines a | |
In the expression: | |
do { a <- readFile "bar.txt"; | |
b <- lines a; | |
return putStrLn b } | |
foo.hs:4:3: | |
Couldn't match type `String -> IO ()' with `IO b0' | |
Expected type: String -> IO b0 | |
Actual type: String -> String -> IO () | |
The function `return' is applied to two arguments, | |
but its type `(String -> IO ()) -> String -> String -> IO ()' | |
has only three | |
In a stmt of a 'do' block: return putStrLn b | |
In the expression: | |
do { a <- readFile "bar.txt"; | |
b <- lines a; | |
return putStrLn b } | |
-} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- foo2.hs | |
main = do | |
a <- readFile "bar.txt" | |
b <- lines a | |
putStrLn b | |
{- | |
foo2.hs:3:8: | |
Couldn't match type `[]' with `IO' | |
Expected type: IO String | |
Actual type: [String] | |
In the return type of a call of `lines' | |
In a stmt of a 'do' block: b <- lines a | |
In the expression: | |
do { a <- readFile "bar.txt"; | |
b <- lines a; | |
putStrLn b } | |
-} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- foo3.hs | |
main = do | |
a <- readFile "bar.txt" | |
let b = lines a | |
return putStrLn b | |
{- | |
runghc foo.hs | |
foo3.hs:4:3: | |
Couldn't match type `String -> IO ()' with `IO b0' | |
Expected type: [String] -> IO b0 | |
Actual type: [String] -> String -> IO () | |
The function `return' is applied to two arguments, | |
but its type `(String -> IO ()) -> [String] -> String -> IO ()' | |
has only three | |
In a stmt of a 'do' block: return putStrLn b | |
In the expression: | |
do { a <- readFile "bar.txt"; | |
let b = lines a; | |
return putStrLn b } | |
-} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- foo4.hs | |
main = do | |
a <- readFile "bar.txt" | |
let b = lines a | |
return putStrLn b | |
{- | |
foo4.hs:4:12: | |
Couldn't match type `[Char]' with `Char' | |
Expected type: String | |
Actual type: [String] | |
In the first argument of `putStrLn', namely `b' | |
In a stmt of a 'do' block: putStrLn b | |
In the expression: | |
do { a <- readFile "bar.txt"; | |
let b = lines a; | |
putStrLn b } | |
-} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment