HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulefilemanip-0.3.6.3Haskell98

System.FilePath.Manip

  • 1 class
  • 4 values
valuemodifyWith
  1. :: Streamable a
  2. => (FilePath -> FilePath -> IO ())

    file manipulation action

  3. -> (a -> a)

    transformation function

  4. -> FilePath
  5. -> IO ()
#

Modify a file in place using the given function. The new content is written to a temporary file. Once this is complete, the file manipulation action is called. Its arguments are the names of the original and temporary files.

Example:

    modifyInPlace = modifyWith (flip rename)
valuemodifyWithBackup
  1. :: Streamable a
  2. => (FilePath -> FilePath)

    chooses new name for original file

  3. -> (a -> a)

    transformation function

  4. -> FilePath

    name of file to modify

  5. -> IO ()
#

Modify a file in place using the given function. The original copy of the file is saved under a new name. This is performed by writing to a temporary file; renaming the original file to its new name; then renaming the temporary file to the original name.

Example:

    -- save original file with a ".bak" extension
    modifyWithBackup (<.> "bak")
valuemodifyInPlace
  1. :: Streamable a
  2. => (a -> a)

    transformation function

  3. -> FilePath

    name of file to modify

  4. -> IO ()
#

Modify a file in place using the given function. This is performed by writing to a temporary file, then renaming it on top of the existing file when done.