-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | A library providing a monadic parser combinator for use with a stream
--   of Abstract Syntax Notation One (ASN.1) standard values.
@package crypton-asn1-parse
@version 0.10.0


-- | A monadic parser combinator for a stream of ASN.1 items.
module Data.ASN1.Parse

-- | Type representing a parser combinator for a stream of ASN.1 items.
data ParseASN1 a

-- | Run the given parse monad over the given list of ASN.1 items. Returns
--   the result and a list of the ASN.1 items remaining in the stream (if
--   successful).
runParseASN1State :: ParseASN1 a -> [ASN1] -> Either String (a, [ASN1])

-- | Run the given parse monad over the given list of ASN.1 items and
--   returns the result (if successful).
--   
--   If ASN.1 items remain in the stream after doing so, returns an error.
runParseASN1 :: ParseASN1 a -> [ASN1] -> Either String a

-- | Throw a parse error.
throwParseError :: String -> ParseASN1 a

-- | Run the parse monad over the elements of the next container of
--   specified type. Throws an error if there is no next container of the
--   specified type.
onNextContainer :: ASN1ConstructionType -> ParseASN1 a -> ParseASN1 a

-- | As for <a>onNextContainer</a>, except that it does not throw an error
--   if there is no next container of the specified type.
onNextContainerMaybe :: ASN1ConstructionType -> ParseASN1 a -> ParseASN1 (Maybe a)

-- | Get the next container of the specified type and return a list of all
--   its ASN.1 elements. Throws a parse error if there is no next container
--   of the specified type.
getNextContainer :: ASN1ConstructionType -> ParseASN1 [ASN1]

-- | As for <a>getNextContainer</a>, except that it does not throw an error
--   if there is no next container of the specified type.
getNextContainerMaybe :: ASN1ConstructionType -> ParseASN1 (Maybe [ASN1])

-- | Get the next ASN.1 item in a stream of ASN.1 items.
getNext :: ParseASN1 ASN1

-- | Applies the given function to the next ASN.1 item in a stream of ASN.1
--   items, if there is one.
getNextMaybe :: (ASN1 -> Maybe a) -> ParseASN1 (Maybe a)

-- | Are there any more ASN.1 items in the stream?
hasNext :: ParseASN1 Bool

-- | Get the object from the next ASN.1 item in a stream of ASN.1 items.
--   Throws a parse error if the object cannot be obtained from the item.
getObject :: ASN1Object a => ParseASN1 a

-- | Get many items from the stream until there are none left.
getMany :: ParseASN1 a -> ParseASN1 [a]
instance GHC.Internal.Base.Alternative Data.ASN1.Parse.ParseASN1
instance GHC.Internal.Base.Applicative Data.ASN1.Parse.ParseASN1
instance GHC.Internal.Base.Functor Data.ASN1.Parse.ParseASN1
instance GHC.Internal.Control.Monad.Fail.MonadFail Data.ASN1.Parse.ParseASN1
instance GHC.Internal.Base.Monad Data.ASN1.Parse.ParseASN1
