It looks like you're new here. If you want to get involved, click one of these buttons!
Good day, I am new to haskell and I am having difficulty compiling the following function definition
chaseFile :: [FilePath] -- ^ path (directories to search) -> String -- ^ base name -> [String] -- ^ possible extensions -> IO String -- ^ contents of file chaseFile dirs basename exts = do results <- mapM tryReadFile fnames case dropWhile hasFailed results of ((Right (fc,fn)):_) -> errLn ("Read file: "++fn) >> return fc _ -> errLn ("Could not find file: "++basename) >> mzero where fnames = [d++'/':basename++'.':e | d <- dirs, e <- exts] hasFailed (Left _) = True hasFailed _ = False tryReadFile fn = try ( readFile fn >>= \fc -> return (fc,fn) )
The compiler gives the following error *** Parser: *** Renamer/typechecker: ..\contrib\StrategyLib-5.0\library\ChaseImports.hs:103:24: Not in scope: 'try'
Thanks in anticiption