Type-safe marshalling between processes of the same executable
This is a pragmatic approach to type-safe marshalling. We define
as an arbitrary value that carries a type identifier with it.
The type identifier is generated when the functor
is applied. Every instantiation of this
functor generates a new type identifier.
The idea is then that an
encap value can be marshalled to another
Marshal, and when it is unwrapped the type identifier
is checked. Unwrapping is only successful when the
from the same functor instantiation is used as the
This module is incompatible with:
- Marshalling to processes running a different executable
- Marshalling to processes that are dynamically loading
- The functor must be instantiated at program initialization time.
Especially this must not happen in
let module expressions.
Only some of these assumptions can be checked at runtime by this
Raised when an encapulated type is tried to be unwrapped by the
wrong encapsulation module
An encapsulated value with a type identifier
module type TYPE =
Just a (monomorphic) type
module type ENCAP =
with type t = T.t
Create an encapsulation module