summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdwardKmett <>2014-08-12 19:57:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2014-08-12 19:57:00 (GMT)
commit6d8c0b73784810bfdba4cf8c5a6ccf016a503fe6 (patch)
tree35ed62f703b657e7e7706e1493cf38b32c17e65e
parentfe13259ddeeadc6c1373050f89d6456bd7187a5d (diff)
version 0.14.10.14.1
-rw-r--r--.travis.yml2
-rw-r--r--bytes.cabal4
-rw-r--r--src/Data/Bytes/Get.hs19
-rw-r--r--src/Data/Bytes/Put.hs2
4 files changed, 24 insertions, 3 deletions
diff --git a/.travis.yml b/.travis.yml
index c46909c..24170a9 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -9,7 +9,7 @@ install:
- export PATH=~/.cabal/bin:$PATH
- cabal configure -flib-Werror $mode
- cabal install packdeps packunused
- - cabal build
+ - cabal build --ghc-option=-ddump-minimal-imports
script:
- $script
diff --git a/bytes.cabal b/bytes.cabal
index 188e655..1faaec5 100644
--- a/bytes.cabal
+++ b/bytes.cabal
@@ -1,6 +1,6 @@
name: bytes
category: Data, Serialization
-version: 0.14.0.2
+version: 0.14.1
license: BSD3
cabal-version: >= 1.8
license-file: LICENSE
@@ -53,7 +53,7 @@ library
text >= 0.2 && < 1.2,
time >= 1.2 && < 1.5,
transformers >= 0.2 && < 0.5,
- transformers-compat >= 0.1 && < 1,
+ transformers-compat >= 0.3 && < 1,
void >= 0.6 && < 0.7
if impl(ghc >= 7.4 && < 7.6)
diff --git a/src/Data/Bytes/Get.hs b/src/Data/Bytes/Get.hs
index 3ad5e0a..656b071 100644
--- a/src/Data/Bytes/Get.hs
+++ b/src/Data/Bytes/Get.hs
@@ -27,6 +27,7 @@ module Data.Bytes.Get
import Control.Applicative
import Control.Monad.Reader
+import Control.Monad.Trans.Except as Except
import Control.Monad.RWS.Lazy as Lazy
import Control.Monad.RWS.Strict as Strict
import Control.Monad.State.Lazy as Lazy
@@ -407,6 +408,24 @@ instance (MonadGet m, Monoid w) => MonadGet (Lazy.RWST r w s m) where
factor = either id id
{-# INLINE lookAheadE #-}
+instance MonadGet m => MonadGet (ExceptT e m) where
+ type Remaining (ExceptT e m) = Remaining m
+ type Bytes (ExceptT e m) = Bytes m
+ lookAhead = mapExceptT lookAhead
+ {-# INLINE lookAhead #-}
+ lookAheadM (ExceptT m) = ExceptT (liftM factor $ lookAheadE $ liftM distribute m)
+ where
+ distribute (Left e) = (Left (Left e))
+ distribute (Right j) = (Right (Right j))
+ factor = either id id
+ {-# INLINE lookAheadM #-}
+ lookAheadE (ExceptT m) = ExceptT (liftM factor $ lookAheadE $ liftM distribute m)
+ where
+ distribute (Left e) = (Left (Left e))
+ distribute (Right a) = (Right (Right a))
+ factor = either id id
+ {-# INLINE lookAheadE #-}
+
-- | Get something from a lazy 'Lazy.ByteString' using 'B.runGet'.
runGetL :: B.Get a -> Lazy.ByteString -> a
runGetL = B.runGet
diff --git a/src/Data/Bytes/Put.hs b/src/Data/Bytes/Put.hs
index 934fa26..2947c34 100644
--- a/src/Data/Bytes/Put.hs
+++ b/src/Data/Bytes/Put.hs
@@ -29,6 +29,7 @@ module Data.Bytes.Put
import Control.Applicative
import Control.Monad.Reader
+import Control.Monad.Trans.Except as Except
import Control.Monad.RWS.Lazy as Lazy
import Control.Monad.RWS.Strict as Strict
import Control.Monad.State.Lazy as Lazy
@@ -240,6 +241,7 @@ instance (MonadPut m, Monoid w) => MonadPut (Lazy.WriterT w m)
instance (MonadPut m, Monoid w) => MonadPut (Strict.WriterT w m)
instance (MonadPut m, Monoid w) => MonadPut (Lazy.RWST r w s m)
instance (MonadPut m, Monoid w) => MonadPut (Strict.RWST r w s m)
+instance (MonadPut m) => MonadPut (ExceptT e m) where
-- | Put a value into a lazy 'Lazy.ByteString' using 'B.runPut'.
runPutL :: B.Put -> Lazy.ByteString