packages feed

asn1-parse 0.8.1 → 0.9.0

raw patch · 2 files changed

+17/−7 lines, 2 filesdep −timedep ~asn1-encodingdep ~asn1-types

Dependencies removed: time

Dependency ranges changed: asn1-encoding, asn1-types

Files

Data/ASN1/Parse.hs view
@@ -7,6 +7,7 @@ -- -- A parser combinator for ASN1 Stream. {-# LANGUAGE GeneralizedNewtypeDeriving #-}+{-# LANGUAGE CPP #-} module Data.ASN1.Parse     ( ParseASN1     -- * run@@ -27,17 +28,27 @@ import Data.ASN1.Types import Data.ASN1.Stream import Control.Monad.State-import Control.Monad.Error import Control.Applicative (Applicative, (<$>)) +#if MIN_VERSION_mtl(2,2,1)+import Control.Monad.Except+runErrT :: ExceptT e m a -> m (Either e a)+runErrT = runExceptT+type ErrT = ExceptT+#else+import Control.Monad.Error+runErrT = runErrorT+type ErrT = ErrorT+#endif+ -- | Parse ASN1 Monad-newtype ParseASN1 a = P { runP :: ErrorT String (State [ASN1]) a }+newtype ParseASN1 a = P { runP :: ErrT String (State [ASN1]) a }     deriving (Functor, Applicative, Monad, MonadError String, MonadState [ASN1])  -- | run the parse monad over a stream and returns the result and the remaining ASN1 Stream. runParseASN1State :: ParseASN1 a -> [ASN1] -> Either String (a,[ASN1]) runParseASN1State f s =-    case runState (runErrorT (runP f)) s of+    case runState (runErrT (runP f)) s of         (Left err, _) -> Left err         (Right r, l)  -> Right (r,l) 
asn1-parse.cabal view
@@ -1,5 +1,5 @@ Name:                asn1-parse-Version:             0.8.1+Version:             0.9.0 Description:         Simple monadic parser for ASN1 stream types, when ASN1 pattern matching is not convenient. License:             BSD3 License-file:        LICENSE@@ -18,9 +18,8 @@                    , bytestring                    , text >= 0.11                    , mtl-                   , time-                   , asn1-types >= 0.2 && < 0.3-                   , asn1-encoding >= 0.8+                   , asn1-types >= 0.3 && < 0.4+                   , asn1-encoding >= 0.9    Exposed-modules:   Data.ASN1.Parse   ghc-options:       -Wall