packages feed

explicit-iomodes 0.1.5 → 0.2

raw patch · 7 files changed

+356/−26 lines, 7 filesdep +bytestringPVP ok

version bump matches the API change (PVP)

Dependencies added: bytestring

API changes (from Hackage documentation)

- System.IO.ExplicitIOModes: instance Eq (Handle ioMode)
- System.IO.ExplicitIOModes: instance Show (Handle ioMode)
- System.IO.ExplicitIOModes: instance Typeable1 Handle
- System.IO.ExplicitIOModes: regularHandle :: Handle ioMode -> Handle
+ 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 ()

Files

+ Data/ByteString/Char8/ExplicitIOModes.hs view
@@ -0,0 +1,85 @@+{-# LANGUAGE UnicodeSyntax, NoImplicitPrelude #-}++-------------------------------------------------------------------------------+-- |+-- Module      :  Data.ByteString.ExplicitIOModes+-- Copyright   :  (c) 2009 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 view
@@ -0,0 +1,85 @@+{-# LANGUAGE UnicodeSyntax, NoImplicitPrelude #-}++-------------------------------------------------------------------------------+-- |+-- Module      :  Data.ByteString.ExplicitIOModes+-- Copyright   :  (c) 2009 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 view
@@ -0,0 +1,67 @@+{-# LANGUAGE UnicodeSyntax, NoImplicitPrelude #-}++-------------------------------------------------------------------------------+-- |+-- Module      :  Data.ByteString.ExplicitIOModes+-- Copyright   :  (c) 2009 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 view
@@ -0,0 +1,73 @@+{-# LANGUAGE UnicodeSyntax, NoImplicitPrelude #-}++-------------------------------------------------------------------------------+-- |+-- Module      :  Data.ByteString.ExplicitIOModes+-- Copyright   :  (c) 2009 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
@@ -1,11 +1,10 @@-{-# LANGUAGE CPP #-}-{-# LANGUAGE NoImplicitPrelude #-}-{-# LANGUAGE UnicodeSyntax #-}-{-# LANGUAGE EmptyDataDecls #-}-{-# LANGUAGE GADTs #-}-{-# LANGUAGE ScopedTypeVariables #-}-{-# LANGUAGE GeneralizedNewtypeDeriving #-}-{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE CPP+           , NoImplicitPrelude+           , UnicodeSyntax+           , EmptyDataDecls+           , GADTs+           , ScopedTypeVariables+  #-}  ------------------------------------------------------------------------------- -- |@@ -39,7 +38,6 @@     , SIO.FilePath      , Handle-    , regularHandle        -- ** IO Modes @@ -218,7 +216,6 @@ import Data.Maybe          ( Maybe(Nothing, Just) ) import Data.Int            ( Int ) import Data.Char           ( Char, String )-import Data.Typeable       ( Typeable ) import Text.Show           ( Show, show ) import System.IO           ( IO, FilePath ) @@ -231,20 +228,11 @@ -- from tagged: import Data.Tagged ( Tagged(Tagged), unTagged ) +-- from ourselves:+import System.IO.ExplicitIOModes.Internal ( Handle(Handle), wrap) --- * Files and handles --- | A handle to a file with an explicit IOMode.------ Wraps: @System.IO.@'SIO.Handle'.-newtype Handle ioMode = Handle-    { -- | Retrieves the regular @System.IO.@'SIO.Handle'.-      regularHandle ∷ SIO.Handle-    }-    deriving ( Show, Eq, Typeable )--wrap ∷ (SIO.Handle → α) → (Handle ioMode → α)-wrap f = f ∘ regularHandle+-- * Files and handles  -- ** IO Modes 
+ System/IO/ExplicitIOModes/Internal.hs view
@@ -0,0 +1,24 @@+{-# LANGUAGE NoImplicitPrelude, UnicodeSyntax, DeriveDataTypeable #-}++module System.IO.ExplicitIOModes.Internal where++-- from base:+import Text.Show                  ( Show )+import Data.Eq                    ( Eq )+import Data.Typeable              ( Typeable )+import qualified System.IO as SIO ( Handle )++-- | A handle to a file with an explicit IOMode.+--+-- Wraps: @System.IO.@'SIO.Handle'.+newtype Handle ioMode = Handle+    { -- | Retrieves the regular @System.IO.@'SIO.Handle'.+      regularHandle ∷ SIO.Handle+    }+    deriving ( Show, Eq, Typeable )++wrap ∷ (SIO.Handle → α) → (Handle ioMode → α)+wrap f = \h → f (regularHandle h)++wrap2 ∷ (SIO.Handle → β → α) → (Handle ioMode → β → α)+wrap2 f = \h y → f (regularHandle h) y
explicit-iomodes.cabal view
@@ -1,5 +1,5 @@ name:          explicit-iomodes-version:       0.1.5+version:       0.2 cabal-version: >=1.6 build-type:    Simple license:       BSD3@@ -22,8 +22,16 @@   Location: http://code.haskell.org/~basvandijk/code/explicit-iomodes  Library-  GHC-Options: -O2 -Wall-  build-depends: base >= 4 && < 4.3+  GHC-Options: -Wall+  build-depends: base                 >= 4     && < 4.3                , base-unicode-symbols >= 0.1.1 && < 0.2-               , tagged == 0.0.*+               , 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