HORIZON HASKELLDocslts/ghc-9.14.xd82dee82026-10-12Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · d82dee8 · 2026-10-12

Modulekes-agent-1.3.0.0Haskell2010

Cardano.KESAgent.Serialization.RawUtil

Various bits and pieces for raw serialization.

  • 2 types
  • 33 values
  • Packagekes-agent-1.3.0.0
  • Exports35
  • LanguageHaskell2010
  • LicenceApache-2.0
  • SourceRawUtil.hs

The ReadResult type

1 declaration
datadata ReadResult a
#

Result of a read operation.

Constructors

Instances4Functor, Eq, Show, Exception
  • Functor ReadResultDefined in kes-agent-1.3.0.0 · Cardano.KESAgent.Serialization.RawUtil
  • Eq a => Eq (ReadResult a)Defined in kes-agent-1.3.0.0 · Cardano.KESAgent.Serialization.RawUtil
  • Show a => Show (ReadResult a)Defined in kes-agent-1.3.0.0 · Cardano.KESAgent.Serialization.RawUtil
  • (Show a, Typeable a) => Exception (ReadResult a)Defined in kes-agent-1.3.0.0 · Cardano.KESAgent.Serialization.RawUtil

The ReadResultT monad transformer.

2 declarations
newtypenewtype ReadResultT (m :: Type -> Type) a
#

This works much like ExceptT, short-circuiting upon encountering any ReadResult other than ReadOK.

Instances4MonadTrans, Monad, Functor, Applicative

ReadResultT send and receive functions for specific types

31 declarations

Unsafe API

1 declaration
valueunsafeReceiveN
  1. :: Monad m
  2. => RawBearer m
  3. -> Ptr CChar
  4. -> CSize
  5. -> m (ReadResult CSize)
#

Receive bytes into a memory buffer through a raw pointer. unsafeReceiveN s buf bufSize will attempt to read up to bufSize bytes from bearer s into the buffer pointed to by buf, returning a ReadOK with the number of bytes actually read on success, or a suitable ReadResult on failure. buf must point to a block of memory at least bufSize bytes in size; it may be larger though. bufSize must not be 0. The return value may signal fewer than bufSize bytes in cases where not enough bytes are available from the bearer. In such cases, the caller should call unsafeReceiveN again with an appropriate bufSize to fetch the remaining bytes.