How to use the compact regions API to write a compact to a file?

Shao, Cheng cheng.shao at
Fri May 22 11:51:10 UTC 2020

Hi Matthew,

It's possible to use Data.Compact.Serialize to write a compact to a
file or read it back. Directly serializing via ByteStrings has also
been discussed before, see link below. Hope this helps!

On Fri, May 22, 2020 at 1:32 PM Matthew Pickering
<matthewtpickering at> wrote:
> Dear devs,
> I have been under the impression for a while that you can write a
> compact region to a file and the functions in GHC.Compact.Serialized
> also seem to suggest this is possible.
> It seems like there are some functions missing from the API. There is
> "importCompactByteStrings"
> but no function in the API which produces ByteStrings. So in order to
> use this function you have to convert a SerializedCompact into a
> ByteString, but in what specific way?
> Has anyone got any code where they have tried to do this?
> Cheers,
> Matt
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at

More information about the ghc-devs mailing list