Je suis en train d'apprendre haskell en écrivant une simple copie de fichier util:erreur du compilateur Haskell: non portée
main = do
putStr "Source: "
srcPath <- getLine
putStr "Destination: "
destPath <- getLine
putStrLn ("Copying from " ++ srcPath ++ " to " ++ destPath ++ "...")
contents <- readFile srcPath
writeFile destPath contents
putStrLn "Finished"
Cela me obtient
GHCi, version 6.10.4: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer ... linking ... done.
Loading package base ... linking ... done.
[1 of 1] Compiling Main (D:\Test.hs, interpreted)
D:\Test.hs:8:22: Not in scope: `contents'
Failed, modules loaded: none.
Prelude>
Je ne comprends pas cette erreur du compilateur car la variable semble être ok. Qu'est-ce qui ne va pas?
Voici un fichier repro: at rapidshare
J'ai téléchargé le fichier hs que j'utilise. – usr