asn1-parse-0.9.4: Simple monadic parser for ASN1 stream types.

LicenseBSD-style
MaintainerVincent Hanquez <vincent@snarc.org>
Stabilityexperimental
Portabilityunknown
Safe HaskellNone
LanguageHaskell98

Data.ASN1.Parse

Contents

Description

A parser combinator for ASN1 Stream.

Synopsis

Documentation

data ParseASN1 a #

Instances
Monad ParseASN1 # 
Instance details

Defined in Data.ASN1.Parse

Methods

(>>=) :: ParseASN1 a -> (a -> ParseASN1 b) -> ParseASN1 b #

(>>) :: ParseASN1 a -> ParseASN1 b -> ParseASN1 b #

return :: a -> ParseASN1 a #

fail :: String -> ParseASN1 a #

Functor ParseASN1 # 
Instance details

Defined in Data.ASN1.Parse

Methods

fmap :: (a -> b) -> ParseASN1 a -> ParseASN1 b #

(<$) :: a -> ParseASN1 b -> ParseASN1 a #

Applicative ParseASN1 # 
Instance details

Defined in Data.ASN1.Parse

Methods

pure :: a -> ParseASN1 a #

(<*>) :: ParseASN1 (a -> b) -> ParseASN1 a -> ParseASN1 b #

liftA2 :: (a -> b -> c) -> ParseASN1 a -> ParseASN1 b -> ParseASN1 c #

(*>) :: ParseASN1 a -> ParseASN1 b -> ParseASN1 b #

(<*) :: ParseASN1 a -> ParseASN1 b -> ParseASN1 a #

run

runParseASN1State :: ParseASN1 a -> [ASN1] -> Either String (a, [ASN1]) #

run the parse monad over a stream and returns the result and the remaining ASN1 Stream.

runParseASN1 :: ParseASN1 a -> [ASN1] -> Either String a #

run the parse monad over a stream and returns the result.

If there's still some asn1 object in the state after calling f, an error will be raised.

throwParseError :: String -> ParseASN1 a #

throw a parse error

combinators

onNextContainer :: ASN1ConstructionType -> ParseASN1 a -> ParseASN1 a #

run a function of the next elements of a container of specified type

onNextContainerMaybe :: ASN1ConstructionType -> ParseASN1 a -> ParseASN1 (Maybe a) #

just like onNextContainer, except it doesn't throw an error if the container doesn't exists.

getNextContainer :: ASN1ConstructionType -> ParseASN1 [ASN1] #

get next container of specified type and return all its elements

getNextContainerMaybe :: ASN1ConstructionType -> ParseASN1 (Maybe [ASN1]) #

just like getNextContainer, except it doesn't throw an error if the container doesn't exists.

getNext :: ParseASN1 ASN1 #

get next element from the stream

getNextMaybe :: (ASN1 -> Maybe a) -> ParseASN1 (Maybe a) #

get next element from the stream maybe

hasNext :: ParseASN1 Bool #

returns if there's more elements in the stream.

getObject :: ASN1Object a => ParseASN1 a #

get next object

getMany :: ParseASN1 a -> ParseASN1 [a] #

get many elements until there's nothing left