Hello community,

here is the log from the commit of package ghc-asn1-parse for openSUSE:Factory 
checked in at 2015-10-06 13:24:19
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-asn1-parse (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-asn1-parse.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-asn1-parse"

Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-asn1-parse/ghc-asn1-parse.changes    
2015-05-21 08:33:53.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.ghc-asn1-parse.new/ghc-asn1-parse.changes       
2015-10-06 13:24:21.000000000 +0200
@@ -1,0 +2,5 @@
+Sun Sep 27 10:02:41 UTC 2015 - [email protected]
+
+- update to 0.9.4 
+
+-------------------------------------------------------------------

Old:
----
  asn1-parse-0.9.1.tar.gz

New:
----
  asn1-parse-0.9.4.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ghc-asn1-parse.spec ++++++
--- /var/tmp/diff_new_pack.ftMzp8/_old  2015-10-06 13:24:21.000000000 +0200
+++ /var/tmp/diff_new_pack.ftMzp8/_new  2015-10-06 13:24:21.000000000 +0200
@@ -19,7 +19,7 @@
 %global pkg_name asn1-parse
 
 Name:           ghc-asn1-parse
-Version:        0.9.1
+Version:        0.9.4
 Release:        0
 Summary:        Simple monadic parser for ASN1 stream types
 License:        BSD-3-Clause

++++++ asn1-parse-0.9.1.tar.gz -> asn1-parse-0.9.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/asn1-parse-0.9.1/Data/ASN1/Parse.hs 
new/asn1-parse-0.9.4/Data/ASN1/Parse.hs
--- old/asn1-parse-0.9.1/Data/ASN1/Parse.hs     2015-04-29 14:26:50.000000000 
+0200
+++ new/asn1-parse-0.9.4/Data/ASN1/Parse.hs     2015-09-21 22:30:42.000000000 
+0200
@@ -7,12 +7,12 @@
 --
 -- A parser combinator for ASN1 Stream.
 {-# LANGUAGE GeneralizedNewtypeDeriving #-}
-{-# LANGUAGE CPP #-}
 module Data.ASN1.Parse
     ( ParseASN1
     -- * run
     , runParseASN1State
     , runParseASN1
+    , throwParseError
     -- * combinators
     , onNextContainer
     , onNextContainerMaybe
@@ -27,30 +27,43 @@
 
 import Data.ASN1.Types
 import Data.ASN1.Stream
-import Control.Monad.State
-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 :: ErrT String (State [ASN1]) a }
-    deriving (Functor, Applicative, Monad, MonadError String, MonadState 
[ASN1])
+import Control.Applicative
+import Control.Arrow (first)
+import Control.Monad (liftM2)
+
+newtype ParseASN1 a = P { runP :: [ASN1] -> Either String (a, [ASN1]) }
+
+instance Functor ParseASN1 where
+    fmap f m = P (either Left (Right . first f) . runP m)
+instance Applicative ParseASN1 where
+    pure a = P $ \s -> Right (a, s)
+    (<*>) mf ma = P $ \s ->
+        case runP mf s of
+            Left err      -> Left err
+            Right (f, s2) ->
+                case runP ma s2 of
+                    Left err      -> Left err
+                    Right (a, s3) -> Right (f a, s3)
+instance Monad ParseASN1 where
+    return a    = pure a
+    (>>=) m1 m2 = P $ \s ->
+        case runP m1 s of
+            Left err      -> Left err
+            Right (a, s2) -> runP (m2 a) s2
+
+get :: ParseASN1 [ASN1]
+get = P $ \stream -> Right (stream, stream)
+
+put :: [ASN1] -> ParseASN1 ()
+put stream = P $ \_ -> Right ((), stream)
+
+-- | throw a parse error
+throwParseError :: String -> ParseASN1 a
+throwParseError s = P $ \_ -> Left s
 
 -- | 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 (runErrT (runP f)) s of
-        (Left err, _) -> Left err
-        (Right r, l)  -> Right (r,l)
+runParseASN1State f s = runP f s
 
 -- | run the parse monad over a stream and returns the result.
 --
@@ -58,17 +71,17 @@
 -- an error will be raised.
 runParseASN1 :: ParseASN1 a -> [ASN1] -> Either String a
 runParseASN1 f s =
-    case runParseASN1State f s of
+    case runP f s of
         Left err      -> Left err
         Right (o, []) -> Right o
-        Right (_, er) -> throwError ("runParseASN1: remaining state " ++ show 
er)
+        Right (_, er) -> Left ("runParseASN1: remaining state " ++ show er)
 
 -- | get next object
 getObject :: ASN1Object a => ParseASN1 a
 getObject = do
     l <- get
     case fromASN1 l of
-        Left err     -> throwError err
+        Left err     -> throwParseError err
         Right (a,l2) -> put l2 >> return a
 
 -- | get next element from the stream
@@ -76,7 +89,7 @@
 getNext = do
     list <- get
     case list of
-        []    -> throwError "empty"
+        []    -> throwParseError "empty"
         (h:l) -> put l >> return h
 
 -- | get many elements until there's nothing left
@@ -104,15 +117,15 @@
 getNextContainer ty = do
     list <- get
     case list of
-        []                    -> throwError "empty"
+        []                    -> throwParseError "empty"
         (h:l) | h == Start ty -> do let (l1, l2) = getConstructedEnd 0 l
                                     put l2 >> return l1
-              | otherwise     -> throwError "not an expected container"
+              | otherwise     -> throwParseError "not an expected container"
 
 
 -- | run a function of the next elements of a container of specified type
 onNextContainer :: ASN1ConstructionType -> ParseASN1 a -> ParseASN1 a
-onNextContainer ty f = getNextContainer ty >>= either throwError return . 
runParseASN1 f
+onNextContainer ty f = getNextContainer ty >>= either throwParseError return . 
runParseASN1 f
 
 -- | just like getNextContainer, except it doesn't throw an error if the 
container doesn't exists.
 getNextContainerMaybe :: ASN1ConstructionType -> ParseASN1 (Maybe [ASN1])
@@ -129,7 +142,7 @@
 onNextContainerMaybe ty f = do
     n <- getNextContainerMaybe ty
     case n of
-        Just l  -> either throwError (return . Just) $ runParseASN1 f l
+        Just l  -> either throwParseError (return . Just) $ runParseASN1 f l
         Nothing -> return Nothing
 
 -- | returns if there's more elements in the stream.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/asn1-parse-0.9.1/asn1-parse.cabal 
new/asn1-parse-0.9.4/asn1-parse.cabal
--- old/asn1-parse-0.9.1/asn1-parse.cabal       2015-04-29 14:26:50.000000000 
+0200
+++ new/asn1-parse-0.9.4/asn1-parse.cabal       2015-09-21 22:30:42.000000000 
+0200
@@ -1,5 +1,5 @@
 Name:                asn1-parse
-Version:             0.9.1
+Version:             0.9.4
 Description:         Simple monadic parser for ASN1 stream types, when ASN1 
pattern matching is not convenient.
 License:             BSD3
 License-file:        LICENSE
@@ -16,10 +16,8 @@
 Library
   Build-Depends:     base >= 3 && < 5
                    , bytestring
-                   , mtl
                    , asn1-types >= 0.3 && < 0.4
                    , asn1-encoding >= 0.9
-
   Exposed-modules:   Data.ASN1.Parse
   ghc-options:       -Wall
 


Reply via email to