safer-file-handles 0.6 → 0.6.1
raw patch · 2 files changed
+52/−6 lines, 2 filesdep ~explicit-iomodesPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: explicit-iomodes
API changes (from Hackage documentation)
+ System.IO.SaferFileHandles: class MkIOMode ioMode
+ System.IO.SaferFileHandles: mkIOMode :: (MkIOMode ioMode) => IOMode ioMode
+ System.IO.SaferFileHandles: openBinaryFile' :: (MonadCatchIO pr, MkIOMode ioMode) => FilePath -> RegionT s pr (RegionalFileHandle ioMode (RegionT s pr))
+ System.IO.SaferFileHandles: openFile' :: (MonadCatchIO pr, MkIOMode ioMode) => FilePath -> RegionT s pr (RegionalFileHandle ioMode (RegionT s pr))
+ System.IO.SaferFileHandles: withBinaryFile' :: (MonadCatchIO pr, MkIOMode ioMode) => FilePath -> (forall s. RegionalFileHandle ioMode (RegionT s pr) -> RegionT s pr α) -> pr α
+ System.IO.SaferFileHandles: withFile' :: (MonadCatchIO pr, MkIOMode ioMode) => FilePath -> (forall s. RegionalFileHandle ioMode (RegionT s pr) -> RegionT s pr α) -> pr α
Files
System/IO/SaferFileHandles.hs view
@@ -54,8 +54,6 @@ -- ** IO Modes -- | Types that represent the IOMode an opened file can be in.- , IOMode(..)- , ReadMode , WriteMode , AppendMode@@ -64,6 +62,9 @@ , ReadModes , WriteModes + , IOMode(..)+ , MkIOMode(mkIOMode)+ -- ** Standard handles {-| These standard handles have concrete IOModes by default which work for the majority of cases. In the rare occasion that you know these@@ -76,6 +77,9 @@ , FilePath , openFile, withFile + -- *** Opening files by inferring the IOMode+ , openFile', withFile'+ -- ** Regions {-| Note that this module re-exports the @Control.Monad.Trans.Region@ module from the @regions@ package which allows you to:@@ -169,6 +173,10 @@ -- * Binary input and output , openBinaryFile, withBinaryFile + -- ** Opening binary files by inferring the IOMode+ , openBinaryFile', withBinaryFile'++ -- ** Operations on binary handles , hSetBinaryMode , hPutBuf , hGetBuf@@ -254,6 +262,7 @@ import System.IO.ExplicitIOModes ( IO , hClose , IOMode(..)+ , MkIOMode(mkIOMode) , ReadMode , WriteMode@@ -393,7 +402,26 @@ → pr α withFile filePath ioMode f = runRegionT $ openFile filePath ioMode >>= f +-- *** Opening files by inferring the IOMode +-- | Open a file without explicitly specifying the IOMode. The IOMode is+-- inferred from the type of the resulting 'RegionalFileHandle'.+--+-- Note that: @openFile' fp = 'openFile' fp 'mkIOMode'@.+openFile' ∷ (MonadCatchIO pr, MkIOMode ioMode)+ ⇒ FilePath+ → RegionT s pr+ (RegionalFileHandle ioMode (RegionT s pr))+openFile' filePath = openFile filePath mkIOMode++-- | Note that: @withFile' filePath = 'withFile' filePath 'mkIOMode'@.+withFile' ∷ (MonadCatchIO pr, MkIOMode ioMode)+ ⇒ FilePath+ → (∀ s. RegionalFileHandle ioMode (RegionT s pr) → RegionT s pr α)+ → pr α+withFile' filePath = withFile filePath mkIOMode++ ------------------------------------------------------------------------------- -- * Operations on regional file handles -------------------------------------------------------------------------------@@ -864,6 +892,24 @@ → (∀ s. RegionalFileHandle ioMode (RegionT s pr) → RegionT s pr α) → pr α withBinaryFile filePath ioMode f = runRegionT $ openBinaryFile filePath ioMode >>= f++-- ** Opening binary files by inferring the IOMode++-- | Note that: @openBinaryFile' filePath = 'openBinaryFile' filePath 'mkIOMode'@.+openBinaryFile' ∷ (MonadCatchIO pr, MkIOMode ioMode)+ ⇒ FilePath+ → RegionT s pr+ (RegionalFileHandle ioMode (RegionT s pr))+openBinaryFile' filePath = openBinaryFile filePath mkIOMode++-- | Note that: @withBinaryFile' filePath = 'withBinaryFile' filePath 'mkIOMode'@.+withBinaryFile' ∷ (MonadCatchIO pr, MkIOMode ioMode)+ ⇒ FilePath+ → (∀ s. RegionalFileHandle ioMode (RegionT s pr) → RegionT s pr α)+ → pr α+withBinaryFile' filePath = withBinaryFile filePath mkIOMode++-- ** Operations on binary handles -- | Select binary mode ('True') or text mode ('False') on a open handle. -- (See also 'openBinaryFile'.)
safer-file-handles.cabal view
@@ -1,5 +1,5 @@ name: safer-file-handles-version: 0.6+version: 0.6.1 cabal-version: >=1.6 build-type: Custom license: BSD3@@ -39,8 +39,8 @@ . @darcs get <http://code.haskell.org/~basvandijk/code/safer-file-handles-examples>@ .- See the @safer-file-handles-bytestring@ package for @ByteString@- operations on regional file handles.+ See the @safer-file-handles-bytestring/text@ package for+ @ByteString/Text@ operations on regional file handles. source-repository head Type: darcs@@ -53,7 +53,7 @@ , regions >= 0.6 && < 0.7 , transformers >= 0.2 && < 0.3 , MonadCatchIO-transformers >= 0.2 && < 0.3- , explicit-iomodes >= 0.3 && < 0.5+ , explicit-iomodes >= 0.4.1 && < 0.5 exposed-modules: System.IO.SaferFileHandles System.IO.SaferFileHandles.Unsafe other-modules: System.IO.SaferFileHandles.Internal