mirage / ocaml-tar

Pure OCaml library to read and write tar files
ISC License
54 stars 34 forks source link

Pure dec enc with gz #143

Closed dinosaure closed 3 months ago

dinosaure commented 9 months ago

/cc @hannesm on top of #140

This is an attempt to implement Tar_gz without requiring I/O. The idea is to describe fold with a GADT instead of using I/O functions directly. Tar_gz then maps these values to introduce the compression level. Finally, Tar_unix and Tar_lwt_unix reuse this GADT with a specific evaluation depending on the backend.

However, as far as Tar_lwt_unix is concerned, the user function cannot currently return an Lwt value. Several solutions exist. The one I've currently used is like the one for awa-ssh, a list of threads that grows (and that we have to resolve) according to the fold computation. Another solution is to make GADT more expressive with the Yallop trick, as I've done here.