[Haskell-beginners] Alfred Programs in Haskell

Richard Guay raguay at customct.com
Wed Mar 4 05:38:24 UTC 2015


Hi,

I am using Haskell to write Alfred programs, but I have run into an 
issue I just can not fix. The routine for reading a data file in a 
application specific location for Alfred never detects the file as 
non-existant. It then dies on the read. Here is the code:

getAlfredCacheFileContents :: String -> IO (String)
getAlfredCacheFileContents fileName = do
     h <- getHomeDirectory
     fExist <- doesFileExist $ h ++ cacheDirBasic ++ getBundleID ++ "/" 
++ fileName
     if fExist
     then do
         contents <- readFile $ h ++ cacheDirBasic ++ getBundleID ++ "/" 
++ fileName
         return contents
     else
         return ""

I just installed the latest version on my Mac Air. It always does the 
call to readFile, even when the file doesn't exist.
-- 
Sent with Postbox <http://www.getpostbox.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20150304/b6819dcb/attachment.html>


More information about the Beginners mailing list