On Wed, Mar 4, 2015 at 12:38 PM, Richard Guay <raguay@customct.com> wrote:
    fExist <- doesFileExist $ h ++ cacheDirBasic ++ getBundleID ++ "/" ++ fileName
    if fExist
    then do
        contents <- readFile $ h ++ cacheDirBasic ++ getBundleID ++ "/" ++ fileName

First of all, let's refactor that into a let binding, e.g.

    let pathName = h ++ cacheDirBasic ++ getBundleID ++ "/" ++ fileName
    fExist <- doesFileExist pathName
    if fExist then readFile pathName else return ""

The advantage of keeping DRY here should be obvious. Defining the same thing in 2 places can lead to both getting out of lockstep.

Now as for debugging the actual problem, have you tried the REPL? That is, launch ghci, load the appropriate libraries, and see what happens when you enter

doesFileExist "/home/me/myfile"

and similarly for readFile. That way you'd rule things out like a file permissions problem, etc.


-- Kim-Ee