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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Matthew Pickering
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.

https://hackage.haskell.org/package/ghc-compact-0.1.0.0/docs/GHC-Compact-Serialized.html

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
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|

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

Shao, Cheng
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!

https://hackage.haskell.org/package/compact
https://github.com/ezyang/compact/issues/3

On Fri, May 22, 2020 at 1:32 PM Matthew Pickering
<[hidden email]> 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.
>
> https://hackage.haskell.org/package/ghc-compact-0.1.0.0/docs/GHC-Compact-Serialized.html
>
> 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
> [hidden email]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|

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

Matthew Pickering
Ah thanks, those links are useful. I was looking in `ghc-compact` not
in the `compact` library.

Cheers,

Matt

On Fri, May 22, 2020 at 12:51 PM Shao, Cheng <[hidden email]> wrote:

>
> 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!
>
> https://hackage.haskell.org/package/compact
> https://github.com/ezyang/compact/issues/3
>
> On Fri, May 22, 2020 at 1:32 PM Matthew Pickering
> <[hidden email]> 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.
> >
> > https://hackage.haskell.org/package/ghc-compact-0.1.0.0/docs/GHC-Compact-Serialized.html
> >
> > 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
> > [hidden email]
> > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs