I don't see the error, unless I'm missing something.
loadFiles :: FilePath -> IO [B.ByteString]
loadFiles dir = do
filePaths <- (getDirectoryContents dir)
mapM (\x loadFile (dir ++ x)) filePaths
I get the error main.hs:33:37: Parse error in pattern: dir ++ x