canonicalFilePath :: FilePath -> IO FilePath
canonicalFilePath fp = do
  exists <- liftM2 (||) (doesFileExist fp) (doesDirectoryExist fp)
  if exists
    then canonicalizePath fp
    else fmap (</> fp) getCurrentDirectory
canonicalFilePath :: FilePath -> IO FilePath
canonicalFilePath fp = do
  exists <- liftM2 (||) (doesFileExist fp) (doesDirectoryExist fp)
  if exists
    then canonicalizePath fp
    else fmap (</> fp) getCurrentDirectory
canonicalFilePath fp = do
  exists <- liftM2 (||) (doesFileExist fp) (doesDirectoryExist fp)
  if exists
    then canonicalizePath fp
    else fmap (</> fp) getCurrentDirectory