For some reason- which I'm hoping to find out by virtue of asking this question- having recently implemented a cadre of updates to a haskell script, including the addition of:
import System.Directory (doesFileExist, removeFile,getPermissions)
which serves to facilitate the following function:
validFile :: FilePath -> IO Bool
validFile path = do
exists <- (doesFileExist path)
if exists
then (readable <$> getPermissions path)
else return False
invoked as:
pwds <- case cfgPasswords of
Just passPath -> do
pathChecksOut <- validFile passPath
when (not pathChecksOut) $
errorL' ("Failed to access file at : " ++ passPath)
(map (Just . T.unpack) . lines) <$> readFileUtf8 passPath
Nothing -> return $ replicate (length cfgPublicKeys) Nothing
I'm not able to anymore build the project on my machine.
The error I got was Couldn't match type ‘[Char]’ with ‘Text’
, and it pointed me to the following line:
errorL' ("Failed to access file at : " ++ passPath)
It seems there's a question about StackOverflow that tries to address a similar issue, this one. In an attempt to follow that advice I adapted the line like so errorL' ("Failed to access file at : " ++ (passPath :: Text))
, but still I wan't able to build the project.
The exact console output I received after implementing the changes you recommend in your last post looks like this:
The full file and the progress of adding this feature (rather bug!) is well encapsulated in this gist file.