packages feed

simple-pipe 0.0.0.8 → 0.0.0.9

raw patch · 3 files changed

+22/−6 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

simple-pipe.cabal view
@@ -2,7 +2,7 @@ cabal-version:	>= 1.8  name:		simple-pipe-version:	0.0.0.8+version:	0.0.0.9 stability:	Experimental author:		Yoshikuni Jujo <PAF01143@nifty.ne.jp> maintainer:	Yoshikuni Jujo <PAF01143@nifty.ne.jp>@@ -87,7 +87,7 @@ source-repository	this     type:	git     location:	git://github.com/YoshikuniJujo/simple-pipe.git-    tag:	simple-pipe-0.0.0.8+    tag:	simple-pipe-0.0.0.9  library     hs-source-dirs:	src
src/Data/Pipe/ByteString.hs view
@@ -1,16 +1,24 @@-{-# LANGUAGE FlexibleContexts, PackageImports #-}+{-# LANGUAGE FlexibleContexts, ScopedTypeVariables, PackageImports #-}  module Data.Pipe.ByteString (fromHandleLn, toHandleLn, fromFileLn, toFileLn) where +import Control.Applicative import "monads-tf" Control.Monad.Trans import Control.Monad.Trans.Control+import Control.Exception (catch) import Data.Pipe import System.IO+import GHC.IO.Exception  import qualified Data.ByteString.Char8 as BSC  fromHandleLn :: MonadIO m => Handle -> Pipe () BSC.ByteString m ()-fromHandleLn h = liftIO (BSC.hGetLine h) >>= (>> fromHandleLn h) . yield+fromHandleLn h = do+	ml <- liftIO $ (Just <$> BSC.hGetLine h) `catch` \(e :: IOException) ->+		case ioe_type e of+			EOF -> return Nothing+			_ -> ioException e+	maybe (return ()) ((>> fromHandleLn h) . yield) ml  toHandleLn :: MonadIO m => Handle -> Pipe BSC.ByteString () m () toHandleLn h =
src/Data/Pipe/IO.hs view
@@ -1,14 +1,22 @@-{-# LANGUAGE FlexibleContexts, PackageImports #-}+{-# LANGUAGE FlexibleContexts, ScopedTypeVariables, PackageImports #-}  module Data.Pipe.IO (fromHandle, toHandle, fromFile, toFile) where +import Control.Applicative import "monads-tf" Control.Monad.Trans import Control.Monad.Trans.Control+import Control.Exception (catch) import Data.Pipe import System.IO+import GHC.IO.Exception  fromHandle :: MonadIO m => Handle -> Pipe () Char m ()-fromHandle h = liftIO (hGetChar h) >>= (>> fromHandle h) . yield+fromHandle h = do+	mc <- liftIO $ (Just <$> hGetChar h) `catch` \(e :: IOException) ->+		case ioe_type e of+			EOF -> return Nothing+			_ -> ioException e+	maybe (return ()) ((>> fromHandle h) . yield) mc  toHandle :: MonadIO m => Handle -> Pipe Char () m () toHandle h = await >>= maybe (return ()) ((>> toHandle h) . liftIO . hPutChar h)