[Haskell-cafe] How is this variable not in scope?
Jeffrey Brown
jeffbrown.the at gmail.com
Fri Jul 21 07:28:35 UTC 2017
The following compiles and runs perfectly:
main = do
(inputFile:_) <- getArgs
input <- readFile inputFile
let pairs = pairFilesToContents $ readSmsnLines input
mapM_ f pairs where
f :: (FilePath, String) -> IO ()
f (name, content) = writeFile name content
But the following triggers the error "Not in scope: ‘root’".
main' = do
(root : inputFile :_) <- getArgs
input <- readFile inputFile
let pairs = pairFilesToContents $ readSmsnLines input
mapM_ f pairs where
f :: (FilePath, String) -> IO ()
f (name, content) = writeFile (root+name) content
--
Jeff Brown | Jeffrey Benjamin Brown
Website <https://msu.edu/~brown202/> | Facebook
<https://www.facebook.com/mejeff.younotjeff> | LinkedIn
<https://www.linkedin.com/in/jeffreybenjaminbrown>(spammy, so I often miss
messages here) | Github <https://github.com/jeffreybenjaminbrown>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20170721/c4ba6c06/attachment-0001.html>
More information about the Haskell-Cafe
mailing list