packages feed

iteratee 0.8.9.5 → 0.8.9.6

raw patch · 6 files changed

+136/−46 lines, 6 filesdep +HUnitdep +QuickCheckdep +criteriondep −MonadCatchIO-transformersdep ~ListLikedep ~basedep ~bytestring

Dependencies added: HUnit, QuickCheck, criterion, deepseq, exceptions, iteratee, mtl, test-framework, test-framework-hunit, test-framework-quickcheck2

Dependencies removed: MonadCatchIO-transformers

Dependency ranges changed: ListLike, base, bytestring, monad-control, transformers, transformers-base

Files

bench/BenchBase.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE RankNTypes, KindSignatures, NoMonomorphismRestriction #-}  -- some basic benchmarking of iteratee@@ -219,7 +220,10 @@       | True            = idone xs (I.Chunk mempty) convBenches = [conv1, conv2] +#if MIN_VERSION_bytestring(0,10,0)+#else instance NFData BS.ByteString where+#endif  instance NFData a => NFData (Sum a) where   rnf (Sum a) = rnf a
iteratee.cabal view
@@ -1,5 +1,5 @@ name:          iteratee-version:       0.8.9.5+version:       0.8.9.6 synopsis:      Iteratee-based I/O description:   The Iteratee monad provides strict, safe, and functional I/O. In addition@@ -47,12 +47,12 @@   build-depends:     base                      >= 3       && < 6,     ListLike                  >= 3.0     && < 5,-    MonadCatchIO-transformers >  0.2     && < 0.4,     monad-control             == 0.3.* ,     bytestring                >= 0.9     && < 0.11,     containers                >= 0.2     && < 0.6,+    exceptions                >= 0.3     && < 0.7,     parallel                  >= 2       && < 4,-    transformers              >= 0.2     && < 0.4,+    transformers              >= 0.2     && < 0.5,     transformers-base         >= 0.4     && < 0.5    exposed-modules:@@ -79,6 +79,63 @@   ghc-options:   -Wall -O2   if impl(ghc >= 6.8)     ghc-options: -fwarn-tabs++Test-Suite testIteratee+  default-language: Haskell2010+  type: exitcode-stdio-1.0+  main-is: testIteratee.hs+  hs-source-dirs: tests src++  if os(windows)+    cpp-options: -DUSE_WINDOWS+  else+    cpp-options: -DUSE_POSIX+    build-depends:+      unix                    >= 2 && < 3++  build-depends:+      base,+      bytestring,+      iteratee,+      exceptions,+      monad-control,+      mtl,+      ListLike,+      transformers,+      transformers-base,+      HUnit                      >= 1.2 ,+      QuickCheck                 >= 2   && < 3,+      test-framework             >= 0.3 && < 0.9,+      test-framework-quickcheck2 >= 0.2 && < 0.4,+      test-framework-hunit       >= 0.2 && < 0.4++benchmark bench-all+  default-language: Haskell2010+  type: exitcode-stdio-1.0+  hs-source-dirs: bench+  main-is:        BenchAll.hs++  if os(windows)+    cpp-options: -DUSE_WINDOWS+  else+    cpp-options: -DUSE_POSIX+    build-depends:+      unix                    >= 2 && < 3++  build-depends:+      iteratee,+      bytestring,+      monad-control,+      exceptions,+      mtl,+      ListLike,+      transformers,+      transformers-base,+      base       >= 3   && < 6,+      criterion  >= 0.6 && < 0.9,+      deepseq    >= 1.2 && < 2,+      mtl+  ghc-options: -O2  source-repository head   type:     git
src/Data/Iteratee/Base.hs view
@@ -1,4 +1,5 @@-{-# LANGUAGE TypeFamilies+{-# LANGUAGE CPP+            ,TypeFamilies             ,MultiParamTypeClasses             ,FlexibleContexts             ,FlexibleInstances@@ -51,11 +52,9 @@ import Control.Monad.Base import Control.Monad.IO.Class import Control.Monad.Trans.Class-import Control.Monad.CatchIO (MonadCatchIO (..), block)-import qualified Control.Monad.CatchIO as EIO import Control.Monad.Trans.Control+import Control.Monad.Catch as CIO import Control.Applicative hiding (empty)-import Control.Exception (SomeException) import qualified Control.Exception as E import Data.Data @@ -177,11 +176,21 @@ instance (MonadIO m, Nullable s, NullPoint s) => MonadIO (Iteratee s m) where   liftIO = lift . liftIO -instance (MonadCatchIO m, Nullable s, NullPoint s) =>-  MonadCatchIO (Iteratee s m) where-    m `catch` f = Iteratee $ \od oc -> runIter m od oc `EIO.catch` (\e -> runIter (f e) od oc)-    block       = ilift block-    unblock     = ilift unblock+instance (MonadThrow m, Nullable s, NullPoint s) =>+  MonadThrow (Iteratee s m) where+    throwM e    = lift $ CIO.throwM e++instance (MonadCatch m, Nullable s, NullPoint s) =>+  MonadCatch (Iteratee s m) where+    m `catch` f = Iteratee $ \od oc -> runIter m od oc `CIO.catch` (\e -> runIter (f e) od oc)++-- prior to exceptions-0.6, these were part of MonadCatch+#if MIN_VERSION_exceptions(0,6,0)+instance (MonadMask m, Nullable s, NullPoint s) =>+  MonadMask (Iteratee s m) where+#endif+    mask q      = Iteratee $ \od oc -> CIO.mask $ \u -> runIter (q $ ilift u) od oc+    uninterruptibleMask q = Iteratee $ \od oc -> CIO.uninterruptibleMask $ \u -> runIter (q $ ilift u) od oc  instance forall s. (NullPoint s, Nullable s) => MonadTransControl (Iteratee s) where   newtype StT (Iteratee s) x =
src/Data/Iteratee/IO.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE CPP #-}+{-# LANGUAGE ConstraintKinds #-}  -- |Random and Binary IO with generic Iteratees. @@ -37,8 +38,14 @@ import qualified Data.Iteratee.IO.Fd as FD #endif -import Control.Monad.CatchIO+import Control.Monad.Catch+import Control.Monad.IO.Class +#if MIN_VERSION_exceptions(0,6,0)+#else+type MonadMask = MonadCatch+#endif+ -- | The default buffer size. defaultBufSize :: Int defaultBufSize = 1024@@ -47,14 +54,14 @@ #if defined(USE_POSIX)  enumFile-  :: (MonadCatchIO m, NullPoint s, ReadableChunk s el) =>+  :: (MonadIO m, MonadMask m, NullPoint s, ReadableChunk s el) =>      Int      -> FilePath      -> Enumerator s m a enumFile = FD.enumFile  enumFileRandom-  :: (MonadCatchIO m, NullPoint s, ReadableChunk s el) =>+  :: (MonadIO m, MonadMask m, NullPoint s, ReadableChunk s el) =>      Int      -> FilePath      -> Enumerator s m a@@ -63,7 +70,7 @@ -- |Process a file using the given Iteratee.  This function wraps -- enumFd as a convenience. fileDriver-  :: (MonadCatchIO m, NullPoint s, ReadableChunk s el) =>+  :: (MonadIO m, MonadMask m, NullPoint s, ReadableChunk s el) =>      Iteratee s m a      -> FilePath      -> m a@@ -71,7 +78,7 @@  -- |A version of fileDriver with a user-specified buffer size (in elements). fileDriverVBuf-  :: (MonadCatchIO m, NullPoint s, ReadableChunk s el) =>+  :: (MonadIO m, MonadMask m, NullPoint s, ReadableChunk s el) =>      Int      -> Iteratee s m a      -> FilePath@@ -81,14 +88,14 @@ -- |Process a file using the given Iteratee.  This function wraps -- enumFdRandom as a convenience. fileDriverRandom-  :: (MonadCatchIO m, NullPoint s, ReadableChunk s el) =>+  :: (MonadIO m, MonadMask m, NullPoint s, ReadableChunk s el) =>      Iteratee s m a      -> FilePath      -> m a fileDriverRandom = FD.fileDriverRandomFd defaultBufSize  fileDriverRandomVBuf-  :: (MonadCatchIO m, NullPoint s, ReadableChunk s el) =>+  :: (MonadIO m, MonadMask m, NullPoint s, ReadableChunk s el) =>      Int      -> Iteratee s m a      -> FilePath@@ -103,7 +110,7 @@ -- |Process a file using the given Iteratee.  This function wraps -- @enumHandle@ as a convenience. fileDriver ::- (MonadCatchIO m, NullPoint s, ReadableChunk s el) =>+ (MonadIO m, MonadMask m, NullPoint s, ReadableChunk s el) =>   Iteratee s m a   -> FilePath   -> m a@@ -111,7 +118,7 @@  -- |A version of fileDriver with a user-specified buffer size (in elements). fileDriverVBuf ::- (MonadCatchIO m, NullPoint s, ReadableChunk s el) =>+ (MonadIO m, MonadMask m, NullPoint s, ReadableChunk s el) =>   Int   -> Iteratee s m a   -> FilePath@@ -121,14 +128,14 @@ -- |Process a file using the given Iteratee.  This function wraps -- @enumRandomHandle@ as a convenience. fileDriverRandom-  :: (MonadCatchIO m, NullPoint s, ReadableChunk s el) =>+  :: (MonadIO m, MonadMask m, NullPoint s, ReadableChunk s el) =>      Iteratee s m a      -> FilePath      -> m a fileDriverRandom = H.fileDriverRandomHandle defaultBufSize  fileDriverRandomVBuf-  :: (MonadCatchIO m, NullPoint s, ReadableChunk s el) =>+  :: (MonadIO m, MonadMask m, NullPoint s, ReadableChunk s el) =>      Int      -> Iteratee s m a      -> FilePath@@ -136,14 +143,14 @@ fileDriverRandomVBuf = H.fileDriverRandomHandle  enumFile-  :: (MonadCatchIO m, NullPoint s, ReadableChunk s el) =>+  :: (MonadIO m, MonadMask m, NullPoint s, ReadableChunk s el) =>      Int      -> FilePath      -> Enumerator s m a enumFile = H.enumFile  enumFileRandom-  :: (MonadCatchIO m, NullPoint s, ReadableChunk s el) =>+  :: (MonadIO m, MonadMask m, NullPoint s, ReadableChunk s el) =>      Int      -> FilePath      -> Enumerator s m a
src/Data/Iteratee/IO/Fd.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE CPP, ScopedTypeVariables #-}+{-# LANGUAGE ConstraintKinds #-}  -- |Random and Binary IO with generic Iteratees, using File Descriptors for IO. -- when available, these are the preferred functions for performing IO as they@@ -30,7 +31,7 @@ import Control.Concurrent (yield) import Control.Exception import Control.Monad-import Control.Monad.CatchIO as CIO+import Control.Monad.Catch as CIO import Control.Monad.IO.Class  import Foreign.Ptr@@ -41,6 +42,12 @@  import System.Posix hiding (FileOffset) +#if MIN_VERSION_exceptions(0,6,0)+#else+type MonadMask = MonadCatch+#endif++ -- ------------------------------------------------------------------------ -- Binary Random IO enumerators @@ -63,7 +70,7 @@ -- over the entire contents of a file, in order, unless stopped by -- the iteratee.  In particular, seeking is not supported. enumFd-  :: forall s el m a.(NullPoint s, ReadableChunk s el, MonadCatchIO m) =>+  :: forall s el m a.(NullPoint s, ReadableChunk s el, MonadIO m, MonadMask m) =>      Int      -> Fd      -> Enumerator s m a@@ -75,7 +82,7 @@  -- |A variant of enumFd that catches exceptions raised by the @Iteratee@. enumFdCatch- :: forall e s el m a.(IException e, NullPoint s, ReadableChunk s el, MonadCatchIO m)+ :: forall e s el m a.(IException e, NullPoint s, ReadableChunk s el, MonadIO m, MonadMask m)     => Int     -> Fd     -> (e -> m (Maybe EnumException))@@ -90,7 +97,7 @@ -- |The enumerator of a POSIX File Descriptor: a variation of @enumFd@ that -- supports RandomIO (seek requests). enumFdRandom- :: forall s el m a.(NullPoint s, ReadableChunk s el, MonadCatchIO m) =>+ :: forall s el m a.(NullPoint s, ReadableChunk s el, MonadIO m, MonadMask m) =>     Int     -> Fd     -> Enumerator s m a@@ -103,7 +110,7 @@             . liftIO . myfdSeek fd AbsoluteSeek $ fromIntegral off  fileDriver-  :: (MonadCatchIO m, ReadableChunk s el) =>+  :: (MonadIO m, MonadMask m, ReadableChunk s el) =>      (Int -> Fd -> Enumerator s m a)      -> Int      -> Iteratee s m a@@ -116,7 +123,7 @@  -- |Process a file using the given @Iteratee@. fileDriverFd-  :: (NullPoint s, MonadCatchIO m, ReadableChunk s el) =>+  :: (NullPoint s, MonadIO m, MonadMask m, ReadableChunk s el) =>      Int -- ^Buffer size (number of elements)      -> Iteratee s m a      -> FilePath@@ -125,14 +132,14 @@  -- |A version of fileDriverFd that supports seeking. fileDriverRandomFd-  :: (NullPoint s, MonadCatchIO m, ReadableChunk s el) =>+  :: (NullPoint s, MonadIO m, MonadMask m, ReadableChunk s el) =>      Int      -> Iteratee s m a      -> FilePath      -> m a fileDriverRandomFd = fileDriver enumFdRandom -enumFile' :: (NullPoint s, MonadCatchIO m, ReadableChunk s el) =>+enumFile' :: (NullPoint s, MonadIO m, MonadMask m, ReadableChunk s el) =>   (Int -> Fd -> Enumerator s m a)   -> Int -- ^Buffer size   -> FilePath@@ -143,14 +150,14 @@   (flip (enumf bufsize) iter)  enumFile ::-  (NullPoint s, MonadCatchIO m, ReadableChunk s el)+  (NullPoint s, MonadIO m, MonadMask m, ReadableChunk s el)   => Int                 -- ^Buffer size   -> FilePath   -> Enumerator s m a enumFile = enumFile' enumFd  enumFileRandom ::-  (NullPoint s, MonadCatchIO m, ReadableChunk s el)+  (NullPoint s, MonadIO m, MonadMask m, ReadableChunk s el)   => Int                 -- ^Buffer size   -> FilePath   -> Enumerator s m a
src/Data/Iteratee/IO/Handle.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE CPP #-}+{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE ScopedTypeVariables #-}  -- |Random and Binary IO with generic Iteratees.  These functions use Handles@@ -25,7 +27,7 @@  import Control.Exception import Control.Monad-import Control.Monad.CatchIO as CIO+import Control.Monad.Catch as CIO import Control.Monad.IO.Class  import Foreign.Ptr@@ -34,12 +36,16 @@  import System.IO +#if MIN_VERSION_exceptions(0,6,0)+#else+type MonadMask = MonadCatch+#endif  -- ------------------------------------------------------------------------ -- Binary Random IO enumerators  makeHandleCallback ::-  (MonadCatchIO m, NullPoint s, ReadableChunk s el) =>+  (MonadIO m, MonadCatch m, NullPoint s, ReadableChunk s el) =>   Ptr el   -> Int   -> Handle@@ -59,7 +65,7 @@ -- the iteratee.  In particular, seeking is not supported. -- Data is read into a buffer of the specified size. enumHandle ::- forall s el m a.(NullPoint s, ReadableChunk s el, MonadCatchIO m) =>+ forall s el m a.(NullPoint s, ReadableChunk s el, MonadIO m, MonadMask m) =>   Int -- ^Buffer size (number of elements per read)   -> Handle   -> Enumerator s m a@@ -76,8 +82,8 @@  forall e s el m a.(IException e,                     NullPoint s,                     ReadableChunk s el,-                    MonadCatchIO m)-  => Int -- ^Buffer size (number of elements per read)+                    MonadIO m, MonadMask m) =>+  Int -- ^Buffer size (number of elements per read)   -> Handle   -> (e -> m (Maybe EnumException))   -> Enumerator s m a@@ -92,7 +98,7 @@ -- supports RandomIO (seek requests). -- Data is read into a buffer of the specified size. enumHandleRandom ::- forall s el m a.(NullPoint s, ReadableChunk s el, MonadCatchIO m) =>+ forall s el m a.(NullPoint s, ReadableChunk s el, MonadIO m, MonadMask m) =>   Int -- ^ Buffer size (number of elements per read)   -> Handle   -> Enumerator s m a@@ -107,7 +113,7 @@ -- ---------------------------------------------- -- File Driver wrapper functions. -enumFile' :: (NullPoint s, MonadCatchIO m, ReadableChunk s el) =>+enumFile' :: (NullPoint s, MonadIO m, MonadMask m, ReadableChunk s el) =>   (Int -> Handle -> Enumerator s m a)   -> Int -- ^Buffer size   -> FilePath@@ -118,14 +124,14 @@   (flip (enumf bufsize) iter)  enumFile ::-  (NullPoint s, MonadCatchIO m, ReadableChunk s el)+  (NullPoint s, MonadIO m, MonadMask m, ReadableChunk s el)   => Int                 -- ^Buffer size   -> FilePath   -> Enumerator s m a enumFile = enumFile' enumHandle  enumFileRandom ::-  (NullPoint s, MonadCatchIO m, ReadableChunk s el)+  (NullPoint s, MonadIO m, MonadMask m, ReadableChunk s el)   => Int                 -- ^Buffer size   -> FilePath   -> Enumerator s m a@@ -134,7 +140,7 @@ -- |Process a file using the given @Iteratee@.  This function wraps -- @enumHandle@ as a convenience. fileDriverHandle-  :: (NullPoint s, MonadCatchIO m, ReadableChunk s el) =>+  :: (NullPoint s, MonadIO m, MonadMask m, ReadableChunk s el) =>      Int                      -- ^Buffer size (number of elements)      -> Iteratee s m a      -> FilePath@@ -144,7 +150,7 @@  -- |A version of @fileDriverHandle@ that supports seeking. fileDriverRandomHandle-  :: (NullPoint s, MonadCatchIO m, ReadableChunk s el) =>+  :: (NullPoint s, MonadIO m, MonadMask m, ReadableChunk s el) =>      Int                      -- ^ Buffer size (number of elements)      -> Iteratee s m a      -> FilePath