The problem is that in the "where" clause the only things which are in scope are (roughly) the arguments of the function. In particular, neither "root" nor "inputFile" nor "input" nor "pairs". The solution is to add an extra argument:main' = do...mapM_ (f root) pairs wheref root (name, content) = writeFile (root ++ name) content2017-07-21 9:28 GMT+02:00 Jeffrey Brown <jeffbrown.the@gmail.com>:______________________________The following compiles and runs perfectly:main = do(inputFile:_) <- getArgsinput <- readFile inputFilelet pairs = pairFilesToContents $ readSmsnLines inputmapM_ f pairs wheref :: (FilePath, String) -> IO ()f (name, content) = writeFile name contentBut the following triggers the error "Not in scope: ‘root’".--main' = do(root : inputFile :_) <- getArgsinput <- readFile inputFilelet pairs = pairFilesToContents $ readSmsnLines inputmapM_ f pairs wheref :: (FilePath, String) -> IO ()f (name, content) = writeFile (root+name) content
_________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-caf e
Only members subscribed via the mailman list are allowed to post.