Capnp.IO

Description

This module provides utilities for reading and writing values to and from file Handles.

Synopsis

# Documentation

hGetValue limit handle reads a message from handle, returning its root object. limit is used as both a cap on the size of a message which may be read and, for types in the high-level API, the traversal limit when decoding the message.

It may throw a Error if there is a problem decoding the message, or an IOError raised by the underlying IO libraries.

getValue is equivalent to hGetValue stdin.

Like hGetMsg, except that it takes a socket instead of a Handle.

Like hGetValue, except that it takes a socket instead of a Handle.

hPutValue :: (Cerialize a, ToStruct (MutMsg RealWorld) (Cerial (MutMsg RealWorld) a)) => Handle -> a -> IO () Source #

hPutValue handle value writes value to handle, as the root object of a message. If it throws an exception, it will be an IOError raised by the underlying IO libraries.

putValue :: (Cerialize a, ToStruct (MutMsg RealWorld) (Cerial (MutMsg RealWorld) a)) => a -> IO () Source #

putValue is equivalent to hPutValue stdin

sPutValue :: (Cerialize a, ToStruct (MutMsg RealWorld) (Cerial (MutMsg RealWorld) a)) => Socket -> a -> IO () Source #

Like hPutValue, except that it takes a Socket instead of a Handle.

sPutMsg :: Socket -> ConstMsg -> IO () Source #

Like hPutMsg, except that it takes a Socket instead of a Handle.

hGetMsg handle limit reads a message from handle that is at most limit 64-bit words in length.

Equivalent to hGetMsg stdin

hPutMsg :: Handle -> ConstMsg -> IO () Source #

hPutMsg handle msg writes msg to handle. If there is an exception, it will be an IOError raised by the underlying IO libraries.

putMsg :: ConstMsg -> IO () Source #

Equivalent to hPutMsg stdout