ghc-events-0.17.0.2: Library and tool for parsing .eventlog files from GHC
Safe HaskellNone
LanguageHaskell2010

GHC.RTS.Events.Incremental

Synopsis

Incremental API

data Decoder a Source #

The unfolding of the decoding process.

Constructors

Consume (ByteString -> Decoder a)

The decoder has consumed all the available input and needs more to continue.

Produce !a (Decoder a)

The decoder has returned a decoded value and the next decoder state to continue.

Done ByteString

The decoder has ended with leftover input.

Error ByteString String

The decoder has encountered an error with leftover input and an error message.

decodeHeader :: Decoder Header Source #

Decode a header

decodeEventLog :: Decoder Event Source #

Decode a header and events

Lazy API

readHeader :: ByteString -> Either String (Header, ByteString) Source #

Read a header from a lazy bytestring and return the header and the leftover input for subsequent decoding.

Note that the input must contain a whole header in one go. If incremental parsing of a header is necessary, use decodeHeader instead.

readEvents :: Header -> ByteString -> ([Event], Maybe String) Source #

Read events from a lazy bytestring. It returns an error message if it encounters an error while decoding.

Note that it doesn't fail if it consumes all input in the middle of decoding of an event.

readEventLog :: ByteString -> Either String (EventLog, Maybe String) Source #

Read an entire eventlog from a lazy bytestring. It returns an error message if it encounters an error while decoding.

Note that it doesn't fail if it consumes all input in the middle of decoding of an event.