explicit-iomodes 0.3 → 0.4
raw patch · 8 files changed
+26/−327 lines, 8 filesdep −bytestringPVP ok
version bump matches the API change (PVP)
Dependencies removed: bytestring
API changes (from Hackage documentation)
- Data.ByteString.Char8.ExplicitIOModes: hGet :: (ReadModes ioMode) => Handle ioMode -> Int -> IO ByteString
- Data.ByteString.Char8.ExplicitIOModes: hGetContents :: (ReadModes ioMode) => Handle ioMode -> IO ByteString
- Data.ByteString.Char8.ExplicitIOModes: hGetLine :: (ReadModes ioMode) => Handle ioMode -> IO ByteString
- Data.ByteString.Char8.ExplicitIOModes: hGetNonBlocking :: (ReadModes ioMode) => Handle ioMode -> Int -> IO ByteString
- Data.ByteString.Char8.ExplicitIOModes: hPut :: (WriteModes ioMode) => Handle ioMode -> ByteString -> IO ()
- Data.ByteString.Char8.ExplicitIOModes: hPutStr :: (WriteModes ioMode) => Handle ioMode -> ByteString -> IO ()
- Data.ByteString.Char8.ExplicitIOModes: hPutStrLn :: (WriteModes ioMode) => Handle ioMode -> ByteString -> IO ()
- Data.ByteString.ExplicitIOModes: hGet :: (ReadModes ioMode) => Handle ioMode -> Int -> IO ByteString
- Data.ByteString.ExplicitIOModes: hGetContents :: (ReadModes ioMode) => Handle ioMode -> IO ByteString
- Data.ByteString.ExplicitIOModes: hGetLine :: (ReadModes ioMode) => Handle ioMode -> IO ByteString
- Data.ByteString.ExplicitIOModes: hGetNonBlocking :: (ReadModes ioMode) => Handle ioMode -> Int -> IO ByteString
- Data.ByteString.ExplicitIOModes: hPut :: (WriteModes ioMode) => Handle ioMode -> ByteString -> IO ()
- Data.ByteString.ExplicitIOModes: hPutStr :: (WriteModes ioMode) => Handle ioMode -> ByteString -> IO ()
- Data.ByteString.ExplicitIOModes: hPutStrLn :: (WriteModes ioMode) => Handle ioMode -> ByteString -> IO ()
- Data.ByteString.Lazy.Char8.ExplicitIOModes: hGet :: (ReadModes ioMode) => Handle ioMode -> Int -> IO ByteString
- Data.ByteString.Lazy.Char8.ExplicitIOModes: hGetContents :: (ReadModes ioMode) => Handle ioMode -> IO ByteString
- Data.ByteString.Lazy.Char8.ExplicitIOModes: hGetNonBlocking :: (ReadModes ioMode) => Handle ioMode -> Int -> IO ByteString
- Data.ByteString.Lazy.Char8.ExplicitIOModes: hPut :: (WriteModes ioMode) => Handle ioMode -> ByteString -> IO ()
- Data.ByteString.Lazy.ExplicitIOModes: hGet :: (ReadModes ioMode) => Handle ioMode -> Int -> IO ByteString
- Data.ByteString.Lazy.ExplicitIOModes: hGetContents :: (ReadModes ioMode) => Handle ioMode -> IO ByteString
- Data.ByteString.Lazy.ExplicitIOModes: hGetNonBlocking :: (ReadModes ioMode) => Handle ioMode -> Int -> IO ByteString
- Data.ByteString.Lazy.ExplicitIOModes: hPut :: (WriteModes ioMode) => Handle ioMode -> ByteString -> IO ()
- Data.ByteString.Lazy.ExplicitIOModes: hPutStr :: (WriteModes ioMode) => Handle ioMode -> ByteString -> IO ()
+ System.IO.ExplicitIOModes.Unsafe: regularHandle :: Handle ioMode -> Handle
+ System.IO.ExplicitIOModes.Unsafe: wrap :: (Handle -> α) -> (Handle ioMode -> α)
+ System.IO.ExplicitIOModes.Unsafe: wrap2 :: (Handle -> β -> α) -> (Handle ioMode -> β -> α)
Files
- Data/ByteString/Char8/ExplicitIOModes.hs +0/−85
- Data/ByteString/ExplicitIOModes.hs +0/−85
- Data/ByteString/Lazy/Char8/ExplicitIOModes.hs +0/−67
- Data/ByteString/Lazy/ExplicitIOModes.hs +0/−73
- System/IO/ExplicitIOModes.hs +2/−1
- System/IO/ExplicitIOModes/Internal.hs +1/−7
- System/IO/ExplicitIOModes/Unsafe.hs +17/−0
- explicit-iomodes.cabal +6/−9
− Data/ByteString/Char8/ExplicitIOModes.hs
@@ -1,85 +0,0 @@-{-# LANGUAGE UnicodeSyntax, NoImplicitPrelude #-}------------------------------------------------------------------------------------ |--- Module : Data.ByteString.ExplicitIOModes--- Copyright : (c) 2009-2010 Bas van Dijk--- License : BSD3 (see the file LICENSE)--- Maintainer : Bas van Dijk <v.dijk.bas@gmail.com>------ This module lifts the bytestring IO operations to handles with explicit--- IOModes.-------------------------------------------------------------------------------------module Data.ByteString.Char8.ExplicitIOModes- ( hGetLine- , hGetContents- , hGet- , hGetNonBlocking-- , hPut- , hPutStr- , hPutStrLn- ) where------------------------------------------------------------------------------------ Imports------------------------------------------------------------------------------------ from base:-import Data.Int ( Int )-import System.IO ( IO )---- from bytestring:-import Data.ByteString.Char8 ( ByteString )-import qualified Data.ByteString.Char8 as B ( hGetLine- , hGetContents- , hGet- , hGetNonBlocking-- , hPut- , hPutStr- , hPutStrLn- )---- from ourselves:-import System.IO.ExplicitIOModes ( ReadModes, WriteModes )-import System.IO.ExplicitIOModes.Internal ( Handle, wrap, wrap2 )------------------------------------------------------------------------------------- ByteString I/O with file handles with explicit IOModes------------------------------------------------------------------------------------ | Wraps @Data.ByteString.@'B.hGetLine'.-hGetLine ∷ ReadModes ioMode ⇒ Handle ioMode → IO ByteString-hGetLine = wrap B.hGetLine---- | Wraps @Data.ByteString.@'B.hGetContents'.-hGetContents ∷ ReadModes ioMode ⇒ Handle ioMode → IO ByteString-hGetContents = wrap B.hGetContents---- | Wraps @Data.ByteString.@'B.hGet'.-hGet ∷ ReadModes ioMode ⇒ Handle ioMode → Int → IO ByteString-hGet = wrap2 B.hGet---- | Wraps @Data.ByteString.@'B.hGetNonBlocking'.-hGetNonBlocking ∷ ReadModes ioMode ⇒ Handle ioMode → Int → IO ByteString-hGetNonBlocking = wrap2 B.hGetNonBlocking----- | Wraps @Data.ByteString.@'B.hPut'.-hPut ∷ WriteModes ioMode ⇒ Handle ioMode → ByteString → IO ()-hPut = wrap2 B.hPut---- | Wraps @Data.ByteString.@'B.hPutStr'.-hPutStr ∷ WriteModes ioMode ⇒ Handle ioMode → ByteString → IO ()-hPutStr = wrap2 B.hPutStr---- | Wraps @Data.ByteString.@'B.hPutStrLn'.-hPutStrLn ∷ WriteModes ioMode ⇒ Handle ioMode → ByteString → IO ()-hPutStrLn = wrap2 B.hPutStrLn----- The End ---------------------------------------------------------------------
− Data/ByteString/ExplicitIOModes.hs
@@ -1,85 +0,0 @@-{-# LANGUAGE UnicodeSyntax, NoImplicitPrelude #-}------------------------------------------------------------------------------------ |--- Module : Data.ByteString.ExplicitIOModes--- Copyright : (c) 2009-2010 Bas van Dijk--- License : BSD3 (see the file LICENSE)--- Maintainer : Bas van Dijk <v.dijk.bas@gmail.com>------ This module lifts the bytestring IO operations to handles with explicit--- IOModes.-------------------------------------------------------------------------------------module Data.ByteString.ExplicitIOModes- ( hGetLine- , hGetContents- , hGet- , hGetNonBlocking-- , hPut- , hPutStr- , hPutStrLn- ) where------------------------------------------------------------------------------------ Imports------------------------------------------------------------------------------------ from base:-import Data.Int ( Int )-import System.IO ( IO )---- from bytestring:-import Data.ByteString ( ByteString )-import qualified Data.ByteString as B ( hGetLine- , hGetContents- , hGet- , hGetNonBlocking-- , hPut- , hPutStr- , hPutStrLn- )---- from ourselves:-import System.IO.ExplicitIOModes ( ReadModes, WriteModes )-import System.IO.ExplicitIOModes.Internal ( Handle, wrap, wrap2 )------------------------------------------------------------------------------------- ByteString I/O with file handles with explicit IOModes------------------------------------------------------------------------------------ | Wraps @Data.ByteString.@'B.hGetLine'.-hGetLine ∷ ReadModes ioMode ⇒ Handle ioMode → IO ByteString-hGetLine = wrap B.hGetLine---- | Wraps @Data.ByteString.@'B.hGetContents'.-hGetContents ∷ ReadModes ioMode ⇒ Handle ioMode → IO ByteString-hGetContents = wrap B.hGetContents---- | Wraps @Data.ByteString.@'B.hGet'.-hGet ∷ ReadModes ioMode ⇒ Handle ioMode → Int → IO ByteString-hGet = wrap2 B.hGet---- | Wraps @Data.ByteString.@'B.hGetNonBlocking'.-hGetNonBlocking ∷ ReadModes ioMode ⇒ Handle ioMode → Int → IO ByteString-hGetNonBlocking = wrap2 B.hGetNonBlocking----- | Wraps @Data.ByteString.@'B.hPut'.-hPut ∷ WriteModes ioMode ⇒ Handle ioMode → ByteString → IO ()-hPut = wrap2 B.hPut---- | Wraps @Data.ByteString.@'B.hPutStr'.-hPutStr ∷ WriteModes ioMode ⇒ Handle ioMode → ByteString → IO ()-hPutStr = wrap2 B.hPutStr---- | Wraps @Data.ByteString.@'B.hPutStrLn'.-hPutStrLn ∷ WriteModes ioMode ⇒ Handle ioMode → ByteString → IO ()-hPutStrLn = wrap2 B.hPutStrLn----- The End ---------------------------------------------------------------------
− Data/ByteString/Lazy/Char8/ExplicitIOModes.hs
@@ -1,67 +0,0 @@-{-# LANGUAGE UnicodeSyntax, NoImplicitPrelude #-}------------------------------------------------------------------------------------ |--- Module : Data.ByteString.ExplicitIOModes--- Copyright : (c) 2009-2010 Bas van Dijk--- License : BSD3 (see the file LICENSE)--- Maintainer : Bas van Dijk <v.dijk.bas@gmail.com>------ This module lifts the bytestring IO operations to handles with explicit--- IOModes.-------------------------------------------------------------------------------------module Data.ByteString.Lazy.Char8.ExplicitIOModes- ( hGetContents- , hGet- , hGetNonBlocking-- , hPut- ) where------------------------------------------------------------------------------------ Imports------------------------------------------------------------------------------------ from base:-import Data.Int ( Int )-import System.IO ( IO )---- from bytestring:-import Data.ByteString.Lazy.Char8 ( ByteString )-import qualified Data.ByteString.Lazy.Char8 as B ( hGetContents- , hGet- , hGetNonBlocking-- , hPut- )---- from ourselves:-import System.IO.ExplicitIOModes ( ReadModes, WriteModes )-import System.IO.ExplicitIOModes.Internal ( Handle, wrap, wrap2 )------------------------------------------------------------------------------------- ByteString I/O with file handles with explicit IOModes------------------------------------------------------------------------------------ | Wraps @Data.ByteString.@'B.hGetContents'.-hGetContents ∷ ReadModes ioMode ⇒ Handle ioMode → IO ByteString-hGetContents = wrap B.hGetContents---- | Wraps @Data.ByteString.@'B.hGet'.-hGet ∷ ReadModes ioMode ⇒ Handle ioMode → Int → IO ByteString-hGet = wrap2 B.hGet---- | Wraps @Data.ByteString.@'B.hGetNonBlocking'.-hGetNonBlocking ∷ ReadModes ioMode ⇒ Handle ioMode → Int → IO ByteString-hGetNonBlocking = wrap2 B.hGetNonBlocking----- | Wraps @Data.ByteString.@'B.hPut'.-hPut ∷ WriteModes ioMode ⇒ Handle ioMode → ByteString → IO ()-hPut = wrap2 B.hPut----- The End ---------------------------------------------------------------------
− Data/ByteString/Lazy/ExplicitIOModes.hs
@@ -1,73 +0,0 @@-{-# LANGUAGE UnicodeSyntax, NoImplicitPrelude #-}------------------------------------------------------------------------------------ |--- Module : Data.ByteString.ExplicitIOModes--- Copyright : (c) 2009-2010 Bas van Dijk--- License : BSD3 (see the file LICENSE)--- Maintainer : Bas van Dijk <v.dijk.bas@gmail.com>------ This module lifts the bytestring IO operations to handles with explicit--- IOModes.-------------------------------------------------------------------------------------module Data.ByteString.Lazy.ExplicitIOModes- ( hGetContents- , hGet- , hGetNonBlocking-- , hPut- , hPutStr- ) where------------------------------------------------------------------------------------ Imports------------------------------------------------------------------------------------ from base:-import Data.Int ( Int )-import System.IO ( IO )---- from bytestring:-import Data.ByteString.Lazy ( ByteString )-import qualified Data.ByteString.Lazy as B ( hGetContents- , hGet- , hGetNonBlocking-- , hPut- , hPutStr- )---- from ourselves:-import System.IO.ExplicitIOModes ( ReadModes, WriteModes )-import System.IO.ExplicitIOModes.Internal ( Handle, wrap, wrap2 )------------------------------------------------------------------------------------- ByteString I/O with file handles with explicit IOModes------------------------------------------------------------------------------------ | Wraps @Data.ByteString.@'B.hGetContents'.-hGetContents ∷ ReadModes ioMode ⇒ Handle ioMode → IO ByteString-hGetContents = wrap B.hGetContents---- | Wraps @Data.ByteString.@'B.hGet'.-hGet ∷ ReadModes ioMode ⇒ Handle ioMode → Int → IO ByteString-hGet = wrap2 B.hGet---- | Wraps @Data.ByteString.@'B.hGetNonBlocking'.-hGetNonBlocking ∷ ReadModes ioMode ⇒ Handle ioMode → Int → IO ByteString-hGetNonBlocking = wrap2 B.hGetNonBlocking----- | Wraps @Data.ByteString.@'B.hPut'.-hPut ∷ WriteModes ioMode ⇒ Handle ioMode → ByteString → IO ()-hPut = wrap2 B.hPut---- | Wraps @Data.ByteString.@'B.hPutStr'.-hPutStr ∷ WriteModes ioMode ⇒ Handle ioMode → ByteString → IO ()-hPutStr = wrap2 B.hPutStr----- The End ---------------------------------------------------------------------
System/IO/ExplicitIOModes.hs view
@@ -239,7 +239,8 @@ import Data.Tagged ( Tagged(Tagged), unTagged ) -- from ourselves:-import System.IO.ExplicitIOModes.Internal ( Handle(Handle), wrap)+import System.IO.ExplicitIOModes.Internal ( Handle(Handle) )+import System.IO.ExplicitIOModes.Unsafe ( wrap ) --------------------------------------------------------------------------------
System/IO/ExplicitIOModes/Internal.hs view
@@ -10,15 +10,9 @@ -- | A handle to a file with an explicit IOMode. ----- Wraps: @System.IO.@'SIO.Handle'.+-- Wraps: @System.IO.'System.IO.Handle'@. newtype Handle ioMode = Handle { -- | Retrieves the regular @System.IO.@'System.IO.Handle'. regularHandle ∷ System.IO.Handle } deriving ( Show, Eq, Typeable )--wrap ∷ (System.IO.Handle → α) → (Handle ioMode → α)-wrap f = \h → f (regularHandle h)--wrap2 ∷ (System.IO.Handle → β → α) → (Handle ioMode → β → α)-wrap2 f = \h y → f (regularHandle h) y
+ System/IO/ExplicitIOModes/Unsafe.hs view
@@ -0,0 +1,17 @@+{-# LANGUAGE NoImplicitPrelude, UnicodeSyntax #-}++module System.IO.ExplicitIOModes.Unsafe ( regularHandle+ , wrap, wrap2+ ) where++-- from base:+import qualified System.IO ( Handle )++-- from ourselves:+import System.IO.ExplicitIOModes.Internal ( Handle, regularHandle )++wrap ∷ (System.IO.Handle → α) → (Handle ioMode → α)+wrap f = \h → f (regularHandle h)++wrap2 ∷ (System.IO.Handle → β → α) → (Handle ioMode → β → α)+wrap2 f = \h y → f (regularHandle h) y
explicit-iomodes.cabal view
@@ -1,5 +1,5 @@ name: explicit-iomodes-version: 0.3+version: 0.4 cabal-version: >=1.6 build-type: Simple license: BSD3@@ -16,6 +16,9 @@ explicitly specify the needed IOMode. This way it is impossible to read from a write-only handle or write to a read-only handle for example.+ .+ See the @explicit-iomodes-bytestring@ package for+ @ByteString@ operations. source-repository head Type: darcs@@ -25,13 +28,7 @@ GHC-Options: -Wall build-depends: base >= 4 && < 4.3 , base-unicode-symbols >= 0.1.1 && < 0.3- , bytestring == 0.9.* , tagged == 0.0.* exposed-modules: System.IO.ExplicitIOModes-- Data.ByteString.ExplicitIOModes- Data.ByteString.Char8.ExplicitIOModes- Data.ByteString.Lazy.ExplicitIOModes- Data.ByteString.Lazy.Char8.ExplicitIOModes-- other-modules: System.IO.ExplicitIOModes.Internal+ System.IO.ExplicitIOModes.Unsafe+ other-modules: System.IO.ExplicitIOModes.Internal