commit ghc-asn1-parse for openSUSE:Factory
Hello community, here is the log from the commit of package ghc-asn1-parse for openSUSE:Factory checked in at 2020-08-28 21:25:03 Comparing /work/SRC/openSUSE:Factory/ghc-asn1-parse (Old) and /work/SRC/openSUSE:Factory/.ghc-asn1-parse.new.3399 (New) Package is "ghc-asn1-parse" Fri Aug 28 21:25:03 2020 rev:11 rq:829174 version:0.9.5 Changes: --- /work/SRC/openSUSE:Factory/ghc-asn1-parse/ghc-asn1-parse.changes 2020-06-19 17:07:52.489176985 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-asn1-parse.new.3399/ghc-asn1-parse.changes 2020-08-28 21:25:11.116434069 +0200 @@ -1,0 +2,5 @@ +Tue Aug 18 10:43:59 UTC 2020 - Peter Simons + +- Replace %setup -q with the more modern %autosetup macro. + +--- Other differences: -- ++ ghc-asn1-parse.spec ++ --- /var/tmp/diff_new_pack.6dsJma/_old 2020-08-28 21:25:12.860434895 +0200 +++ /var/tmp/diff_new_pack.6dsJma/_new 2020-08-28 21:25:12.864434897 +0200 @@ -1,7 +1,7 @@ # # spec file for package ghc-asn1-parse # -# Copyright (c) 2019 SUSE LLC +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -45,7 +45,7 @@ This package provides the Haskell %{pkg_name} library development files. %prep -%setup -q -n %{pkg_name}-%{version} +%autosetup -n %{pkg_name}-%{version} %build %ghc_lib_build
commit ghc-asn1-parse for openSUSE:Factory
Hello community, here is the log from the commit of package ghc-asn1-parse for openSUSE:Factory checked in at 2020-06-19 17:07:51 Comparing /work/SRC/openSUSE:Factory/ghc-asn1-parse (Old) and /work/SRC/openSUSE:Factory/.ghc-asn1-parse.new.3606 (New) Package is "ghc-asn1-parse" Fri Jun 19 17:07:51 2020 rev:10 rq:815030 version:0.9.5 Changes: --- /work/SRC/openSUSE:Factory/ghc-asn1-parse/ghc-asn1-parse.changes 2019-12-27 13:51:27.840577511 +0100 +++ /work/SRC/openSUSE:Factory/.ghc-asn1-parse.new.3606/ghc-asn1-parse.changes 2020-06-19 17:07:52.489176985 +0200 @@ -1,0 +2,5 @@ +Tue Jun 16 11:13:43 UTC 2020 - Peter Simons + +- Re-generate file with latest version of spec-cleaner. + +--- Other differences: -- ++ ghc-asn1-parse.spec ++ --- /var/tmp/diff_new_pack.VVtkxJ/_old 2020-06-19 17:07:53.225178903 +0200 +++ /var/tmp/diff_new_pack.VVtkxJ/_new 2020-06-19 17:07:53.229178914 +0200 @@ -1,7 +1,7 @@ # # spec file for package ghc-asn1-parse # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed
commit ghc-asn1-parse for openSUSE:Factory
Hello community, here is the log from the commit of package ghc-asn1-parse for openSUSE:Factory checked in at 2019-12-27 13:51:26 Comparing /work/SRC/openSUSE:Factory/ghc-asn1-parse (Old) and /work/SRC/openSUSE:Factory/.ghc-asn1-parse.new.6675 (New) Package is "ghc-asn1-parse" Fri Dec 27 13:51:26 2019 rev:9 rq:759336 version:0.9.5 Changes: --- /work/SRC/openSUSE:Factory/ghc-asn1-parse/ghc-asn1-parse.changes 2019-10-18 14:33:44.564191063 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-asn1-parse.new.6675/ghc-asn1-parse.changes 2019-12-27 13:51:27.840577511 +0100 @@ -1,0 +2,5 @@ +Fri Nov 8 16:13:13 UTC 2019 - Peter Simons + +- Drop obsolete group attributes. + +--- Other differences: -- ++ ghc-asn1-parse.spec ++ --- /var/tmp/diff_new_pack.WgJIls/_old 2019-12-27 13:51:28.464577954 +0100 +++ /var/tmp/diff_new_pack.WgJIls/_new 2019-12-27 13:51:28.464577954 +0100 @@ -22,7 +22,6 @@ Release:0 Summary:Simple monadic parser for ASN1 stream types License:BSD-3-Clause -Group: Development/Libraries/Haskell URL:https://hackage.haskell.org/package/%{pkg_name} Source0: https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz BuildRequires: ghc-Cabal-devel @@ -37,7 +36,6 @@ %package devel Summary:Haskell %{pkg_name} library development files -Group: Development/Libraries/Haskell Requires: %{name} = %{version}-%{release} Requires: ghc-compiler = %{ghc_version} Requires(post): ghc-compiler = %{ghc_version}
commit ghc-asn1-parse for openSUSE:Factory
Hello community, here is the log from the commit of package ghc-asn1-parse for openSUSE:Factory checked in at 2019-10-18 14:33:43 Comparing /work/SRC/openSUSE:Factory/ghc-asn1-parse (Old) and /work/SRC/openSUSE:Factory/.ghc-asn1-parse.new.2352 (New) Package is "ghc-asn1-parse" Fri Oct 18 14:33:43 2019 rev:8 rq:737191 version:0.9.5 Changes: --- /work/SRC/openSUSE:Factory/ghc-asn1-parse/ghc-asn1-parse.changes 2018-10-25 08:22:24.615909590 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-asn1-parse.new.2352/ghc-asn1-parse.changes 2019-10-18 14:33:44.564191063 +0200 @@ -1,0 +2,6 @@ +Mon Sep 30 02:01:28 UTC 2019 - psim...@suse.com + +- Update asn1-parse to version 0.9.5. + Upstream does not provide a change log file. + +--- Old: asn1-parse-0.9.4.tar.gz New: asn1-parse-0.9.5.tar.gz Other differences: -- ++ ghc-asn1-parse.spec ++ --- /var/tmp/diff_new_pack.uASQbf/_old 2019-10-18 14:33:45.308189126 +0200 +++ /var/tmp/diff_new_pack.uASQbf/_new 2019-10-18 14:33:45.308189126 +0200 @@ -1,7 +1,7 @@ # # spec file for package ghc-asn1-parse # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %global pkg_name asn1-parse Name: ghc-%{pkg_name} -Version:0.9.4 +Version:0.9.5 Release:0 Summary:Simple monadic parser for ASN1 stream types License:BSD-3-Clause ++ asn1-parse-0.9.4.tar.gz -> asn1-parse-0.9.5.tar.gz ++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asn1-parse-0.9.4/Data/ASN1/Parse.hs new/asn1-parse-0.9.5/Data/ASN1/Parse.hs --- old/asn1-parse-0.9.4/Data/ASN1/Parse.hs 2015-09-21 22:30:42.0 +0200 +++ new/asn1-parse-0.9.5/Data/ASN1/Parse.hs 2019-06-23 15:18:23.0 +0200 @@ -7,6 +7,7 @@ -- -- A parser combinator for ASN1 Stream. {-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE CPP #-} module Data.ASN1.Parse ( ParseASN1 -- * run @@ -30,6 +31,9 @@ import Control.Applicative import Control.Arrow (first) import Control.Monad (liftM2) +#if MIN_VERSION_base(4,9,0) +import Control.Monad.Fail +#endif newtype ParseASN1 a = P { runP :: [ASN1] -> Either String (a, [ASN1]) } @@ -50,6 +54,16 @@ case runP m1 s of Left err -> Left err Right (a, s2) -> runP (m2 a) s2 +instance Alternative ParseASN1 where +empty = P $ \_ -> Left "empty Alternative" +(<|>) m1 m2 = P $ \s -> +case runP m1 s of +Left _-> runP m2 s +Right (a, s2) -> Right (a, s2) +#if MIN_VERSION_base(4,9,0) +instance MonadFail ParseASN1 where +fail = throwParseError +#endif get :: ParseASN1 [ASN1] get = P $ \stream -> Right (stream, stream) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asn1-parse-0.9.4/asn1-parse.cabal new/asn1-parse-0.9.5/asn1-parse.cabal --- old/asn1-parse-0.9.4/asn1-parse.cabal 2015-09-21 22:30:42.0 +0200 +++ new/asn1-parse-0.9.5/asn1-parse.cabal 2019-09-29 21:06:27.0 +0200 @@ -1,5 +1,5 @@ Name:asn1-parse -Version: 0.9.4 +Version: 0.9.5 Description: Simple monadic parser for ASN1 stream types, when ASN1 pattern matching is not convenient. License: BSD3 License-file:LICENSE @@ -24,3 +24,4 @@ source-repository head type: git location: https://github.com/vincenthz/hs-asn1 + subdir: parse
commit ghc-asn1-parse for openSUSE:Factory
Hello community, here is the log from the commit of package ghc-asn1-parse for openSUSE:Factory checked in at 2018-10-25 08:22:22 Comparing /work/SRC/openSUSE:Factory/ghc-asn1-parse (Old) and /work/SRC/openSUSE:Factory/.ghc-asn1-parse.new (New) Package is "ghc-asn1-parse" Thu Oct 25 08:22:22 2018 rev:7 rq:643347 version:0.9.4 Changes: --- /work/SRC/openSUSE:Factory/ghc-asn1-parse/ghc-asn1-parse.changes 2018-07-24 17:12:52.950564868 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-asn1-parse.new/ghc-asn1-parse.changes 2018-10-25 08:22:24.615909590 +0200 @@ -1,0 +2,5 @@ +Sat Oct 20 11:31:10 UTC 2018 - Peter Simons + +- Use https URL to refer to bugs.opensuse.org. + +--- Other differences: -- ++ ghc-asn1-parse.spec ++ --- /var/tmp/diff_new_pack.8tW6Oi/_old 2018-10-25 08:22:25.167909342 +0200 +++ /var/tmp/diff_new_pack.8tW6Oi/_new 2018-10-25 08:22:25.167909342 +0200 @@ -12,7 +12,7 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ #
commit ghc-asn1-parse for openSUSE:Factory
Hello community, here is the log from the commit of package ghc-asn1-parse for openSUSE:Factory checked in at 2018-07-24 17:12:49 Comparing /work/SRC/openSUSE:Factory/ghc-asn1-parse (Old) and /work/SRC/openSUSE:Factory/.ghc-asn1-parse.new (New) Package is "ghc-asn1-parse" Tue Jul 24 17:12:49 2018 rev:6 rq:623715 version:0.9.4 Changes: --- /work/SRC/openSUSE:Factory/ghc-asn1-parse/ghc-asn1-parse.changes 2018-05-30 12:23:23.273959789 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-asn1-parse.new/ghc-asn1-parse.changes 2018-07-24 17:12:52.950564868 +0200 @@ -1,0 +2,6 @@ +Wed Jul 18 14:26:13 UTC 2018 - psim...@suse.com + +- Cosmetic: replace tabs with blanks, strip trailing white space, + and update copyright headers with spec-cleaner. + +--- @@ -30 +35,0 @@ - Other differences: -- ++ ghc-asn1-parse.spec ++ --- /var/tmp/diff_new_pack.ZWdZnf/_old 2018-07-24 17:12:53.410565466 +0200 +++ /var/tmp/diff_new_pack.ZWdZnf/_new 2018-07-24 17:12:53.414565471 +0200 @@ -1,7 +1,7 @@ # # spec file for package ghc-asn1-parse # -# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed
commit ghc-asn1-parse for openSUSE:Factory
Hello community, here is the log from the commit of package ghc-asn1-parse for openSUSE:Factory checked in at 2018-05-30 12:16:45 Comparing /work/SRC/openSUSE:Factory/ghc-asn1-parse (Old) and /work/SRC/openSUSE:Factory/.ghc-asn1-parse.new (New) Package is "ghc-asn1-parse" Wed May 30 12:16:45 2018 rev:5 rq:609759 version:0.9.4 Changes: --- /work/SRC/openSUSE:Factory/ghc-asn1-parse/ghc-asn1-parse.changes 2017-09-15 21:20:36.377215452 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-asn1-parse.new/ghc-asn1-parse.changes 2018-05-30 12:23:23.273959789 +0200 @@ -1,0 +2,5 @@ +Wed May 16 13:06:51 UTC 2018 - psim...@suse.com + +- Prefer the new %license attribute over %doc. + +--- Other differences: -- ++ ghc-asn1-parse.spec ++ --- /var/tmp/diff_new_pack.YT0aEB/_old 2018-05-30 12:23:23.909940511 +0200 +++ /var/tmp/diff_new_pack.YT0aEB/_new 2018-05-30 12:23:23.913940390 +0200 @@ -62,7 +62,7 @@ %ghc_pkg_recache %files -f %{name}.files -%doc LICENSE +%license LICENSE %files devel -f %{name}-devel.files
commit ghc-asn1-parse for openSUSE:Factory
Hello community, here is the log from the commit of package ghc-asn1-parse for openSUSE:Factory checked in at 2017-09-15 21:20:35 Comparing /work/SRC/openSUSE:Factory/ghc-asn1-parse (Old) and /work/SRC/openSUSE:Factory/.ghc-asn1-parse.new (New) Package is "ghc-asn1-parse" Fri Sep 15 21:20:35 2017 rev:4 rq:524135 version:0.9.4 Changes: --- /work/SRC/openSUSE:Factory/ghc-asn1-parse/ghc-asn1-parse.changes 2016-08-03 11:44:34.0 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-asn1-parse.new/ghc-asn1-parse.changes 2017-09-15 21:20:36.377215452 +0200 @@ -1,0 +2,5 @@ +Thu Aug 3 15:38:38 UTC 2017 - psim...@suse.com + +- Updated with latest spec-cleaner version 0.9.8-8-geadfbbf. + +--- Other differences: -- ++ ghc-asn1-parse.spec ++ --- /var/tmp/diff_new_pack.TUmtdE/_old 2017-09-15 21:20:37.928996701 +0200 +++ /var/tmp/diff_new_pack.TUmtdE/_new 2017-09-15 21:20:37.932996138 +0200 @@ -1,7 +1,7 @@ # # spec file for package ghc-asn1-parse # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -22,15 +22,14 @@ Release:0 Summary:Simple monadic parser for ASN1 stream types License:BSD-3-Clause -Group: System/Libraries -Url:https://hackage.haskell.org/package/%{pkg_name} +Group: Development/Libraries/Haskell +URL:https://hackage.haskell.org/package/%{pkg_name} Source0: https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz BuildRequires: ghc-Cabal-devel BuildRequires: ghc-asn1-encoding-devel BuildRequires: ghc-asn1-types-devel BuildRequires: ghc-bytestring-devel BuildRequires: ghc-rpm-macros -BuildRoot: %{_tmppath}/%{name}-%{version}-build %description Simple monadic parser for ASN1 stream types, when ASN1 pattern matching is not @@ -38,7 +37,7 @@ %package devel Summary:Haskell %{pkg_name} library development files -Group: Development/Libraries/Other +Group: Development/Libraries/Haskell Requires: %{name} = %{version}-%{release} Requires: ghc-compiler = %{ghc_version} Requires(post): ghc-compiler = %{ghc_version} @@ -50,15 +49,12 @@ %prep %setup -q -n %{pkg_name}-%{version} - %build %ghc_lib_build - %install %ghc_lib_install - %post devel %ghc_pkg_recache @@ -66,10 +62,8 @@ %ghc_pkg_recache %files -f %{name}.files -%defattr(-,root,root,-) %doc LICENSE %files devel -f %{name}-devel.files -%defattr(-,root,root,-) %changelog
commit ghc-asn1-parse for openSUSE:Factory
Hello community, here is the log from the commit of package ghc-asn1-parse for openSUSE:Factory checked in at 2016-08-03 11:44: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-10-06 13:24:21.0 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-asn1-parse.new/ghc-asn1-parse.changes 2016-08-03 11:44:34.0 +0200 @@ -1,0 +2,5 @@ +Sun Jul 10 17:20:10 UTC 2016 - psim...@suse.com + +- Update to version 0.9.4 revision 0 with cabal2obs. + +--- Other differences: -- ++ ghc-asn1-parse.spec ++ --- /var/tmp/diff_new_pack.AB04br/_old 2016-08-03 11:44:36.0 +0200 +++ /var/tmp/diff_new_pack.AB04br/_new 2016-08-03 11:44:36.0 +0200 @@ -1,7 +1,7 @@ # # spec file for package ghc-asn1-parse # -# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,54 +17,48 @@ %global pkg_name asn1-parse - -Name: ghc-asn1-parse +Name: ghc-%{pkg_name} Version:0.9.4 Release:0 Summary:Simple monadic parser for ASN1 stream types License:BSD-3-Clause Group: System/Libraries - Url:https://hackage.haskell.org/package/%{pkg_name} Source0: https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-build - BuildRequires: ghc-Cabal-devel -BuildRequires: ghc-rpm-macros -# Begin cabal-rpm deps: BuildRequires: ghc-asn1-encoding-devel BuildRequires: ghc-asn1-types-devel BuildRequires: ghc-bytestring-devel -BuildRequires: ghc-mtl-devel -BuildRequires: ghc-text-devel -# End cabal-rpm deps +BuildRequires: ghc-rpm-macros +BuildRoot: %{_tmppath}/%{name}-%{version}-build %description Simple monadic parser for ASN1 stream types, when ASN1 pattern matching is not convenient. - %package devel Summary:Haskell %{pkg_name} library development files Group: Development/Libraries/Other +Requires: %{name} = %{version}-%{release} Requires: ghc-compiler = %{ghc_version} Requires(post): ghc-compiler = %{ghc_version} Requires(postun): ghc-compiler = %{ghc_version} -Requires: %{name} = %{version}-%{release} %description devel This package provides the Haskell %{pkg_name} library development files. - %prep %setup -q -n %{pkg_name}-%{version} + %build %ghc_lib_build + %install %ghc_lib_install + %post devel %ghc_pkg_recache
commit ghc-asn1-parse for openSUSE:Factory
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.0 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-asn1-parse.new/ghc-asn1-parse.changes 2015-10-06 13:24:21.0 +0200 @@ -1,0 +2,5 @@ +Sun Sep 27 10:02:41 UTC 2015 - mimi...@gmail.com + +- 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.0 +0200 +++ /var/tmp/diff_new_pack.ftMzp8/_new 2015-10-06 13:24:21.0 +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.0 +0200 +++ new/asn1-parse-0.9.4/Data/ASN1/Parse.hs 2015-09-21 22:30:42.0 +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"