packman-0.5.0: Serialization library for GHC

Copyright(c) Jost Berthold 2010-2015
LicenseBSD3
Maintainerjost.berthold@gmail.com
Stabilityexperimental
Portabilityno (depends on GHC internals)
Safe HaskellNone
LanguageHaskell2010

GHC.Packing.PackException

Description

Exception type for packman library, using magic constants #include'd from a C header file shared with the foreign primitive operation code.

PackExceptions can occur at Haskell level or in the foreign primop.

All Haskell-level exceptions are cases of invalid data when reading and deserialising Serialised data:

  • P_BinaryMismatch: serialised data were produced by a different executable (must be the same binary).
  • P_TypeMismatch: serialised data have the wrong type
  • P_ParseError: serialised data could not be parsed (from binary or text format)

The exceptions caused by the foreign primops (return codes) indicate errors at the C level. Most of them can occur when serialising data; the exception is P_GARBLED which indicates that serialised data is garbled.

Synopsis

Documentation

data PackException Source #

Packing exception codes, matching error codes implemented in the runtime system or describing errors which can occur within Haskell.

Constructors

P_SUCCESS

no error, ==0. Internal code, should never be seen by users.

P_BLACKHOLE

RTS: packing hit a blackhole. Used internally, not passed to users.

P_NOBUFFER

RTS: buffer too small

P_CANNOTPACK

RTS: contains closure which cannot be packed (MVar, TVar)

P_UNSUPPORTED

RTS: contains unsupported closure type (implementation missing)

P_IMPOSSIBLE

RTS: impossible case (stack frame, message,...RTS bug!)

P_GARBLED

RTS: corrupted data for deserialisation

P_ParseError

Haskell: Packet data could not be parsed

P_BinaryMismatch

Haskell: Executable binaries do not match

P_TypeMismatch

Haskell: Packet data encodes unexpected type

decodeEx :: Int# -> PackException Source #

decodes an Int# to a PackException. Magic constants are read from file cbits/Errors.h.

isBHExc :: Int# -> Bool Source #

internal: checks if the given code indicates P_BLACKHOLE