Safe Haskell | None |
---|---|
Language | Haskell2010 |
Documentation
writeCompact :: Typeable a => FilePath -> Compact a -> IO () Source #
Write a compact region to a file. The resulting file can
be read back into memory using unsafeReadCompact
.
unsafeReadCompact :: Typeable a => FilePath -> IO (Either String (Compact a)) Source #
Read out a compact region that was serialized to a file.
See hUnsafeGetCompact
for safety considerations when using this function.
hPutCompact :: Typeable a => Handle -> Compact a -> IO () Source #
Write a compact region to a Handle
. The compact region
can be read out of the handle by using hUnsafeGetCompact
.
hUnsafeGetCompact :: forall a. Typeable a => Handle -> IO (Either String (Compact a)) Source #
Read out a compact region from a handle.
Compact regions written to handles this way are subject to some restrictions:
- Our binary representation contains direct pointers to the info tables of objects in the region. This means that the info tables of the receiving process must be laid out in exactly the same way as from the original process; in practice, this means using static linking, using the exact same binary and turning off ASLR. This API does NOT do any safety checking and will probably segfault if you get it wrong. DO NOT run this on untrusted input.
- You must read out the value at the correct type. We will
check this for you and raise an error if the types do not match
(this is what the
Typeable
constraint is for).