diff --git a/atomic-write.cabal b/atomic-write.cabal
--- a/atomic-write.cabal
+++ b/atomic-write.cabal
@@ -1,7 +1,7 @@
 name:                atomic-write
-version:             0.2.0.3
+version:             0.2.0.4
 synopsis:            Atomically write to a file
-
+homepage:            https://github.com/stackbuilders/atomic-write
 description:
   .
   Atomically write to a file on POSIX-compliant systems while preserving
@@ -58,7 +58,7 @@
 
   other-modules:       System.AtomicWrite.Internal
 
-  build-depends:         base >=4.5 && <4.8
+  build-depends:         base >= 4.5 && < 4.9
                        , temporary
                        , unix-compat
                        , directory
@@ -75,14 +75,13 @@
   hs-source-dirs: spec, src
   main-is: Spec.hs
 
-  build-depends:       base >=4.5 && <4.8
+  build-depends:       base >= 4.5 && < 4.9
                      , temporary
                      , unix-compat
                      , directory
                      , filepath
                      , text
                      , bytestring >= 0.10.4
-
                      , hspec
 
   default-language:    Haskell2010
diff --git a/src/System/AtomicWrite/Writer/String.hs b/src/System/AtomicWrite/Writer/String.hs
--- a/src/System/AtomicWrite/Writer/String.hs
+++ b/src/System/AtomicWrite/Writer/String.hs
@@ -1,8 +1,8 @@
-module System.AtomicWrite.Writer.String (atomicWriteFile) where
+module System.AtomicWrite.Writer.String (atomicWriteFile, atomicWithFile) where
 
 import System.AtomicWrite.Internal (closeAndRename, tempFileFor)
 
-import System.IO (hPutStr)
+import System.IO (Handle, hPutStr)
 
 -- | Creates a file atomically on POSIX-compliant systems while preserving
 -- permissions.
@@ -10,5 +10,9 @@
   FilePath   -- ^ The path where the file will be updated or created
   -> String  -- ^ The content to write to the file
   -> IO ()
-atomicWriteFile f txt =
-  tempFileFor f >>= \(tmpPath, h) -> hPutStr h txt >> closeAndRename h tmpPath f
+atomicWriteFile = (. flip hPutStr) . atomicWithFile
+
+-- | A general version of 'atomicWriteFile'
+atomicWithFile :: FilePath -> (Handle -> IO ()) -> IO ()
+atomicWithFile f action = 
+  tempFileFor f >>= \(tmpPath, h) -> action h >> closeAndRename h tmpPath f
