safely :: FilePath -> IO () -> IO ()
safely fp = (`catchIO` (hPutStrLn stderr . fmt . show))
  where
    fmt msg = "** ERROR "
        ++ (if fp `isInfixOf` msg then "" else fp ++ ": ") ++ msg

-- | Recursively remove a directory. Like shell command "rm -rf".
-- Unlike System.Directory.removeDirectoryRecursive, doesn't follow symlinks.
safely :: FilePath -> IO () -> IO ()
safely fp = (`catchIO` (hPutStrLn stderr . fmt . show))
  where
    fmt msg = "** ERROR "
        ++ (if fp `isInfixOf` msg then "" else fp ++ ": ") ++ msg

-- | Recursively remove a directory. Like shell command "rm -rf".
-- Unlike System.Directory.removeDirectoryRecursive, doesn't follow symlinks.
safely fp = (`catchIO` (hPutStrLn stderr . fmt . show))
  where
    fmt msg = "** ERROR "
        ++ (if fp `isInfixOf` msg then "" else fp ++ ": ") ++ msg

-- | Recursively remove a directory. Like shell command "rm -rf".
-- Unlike System.Directory.removeDirectoryRecursive, doesn't follow symlinks.