[plt-dev] type-scheme wrapper for file/tar

From: Sam TH (samth at ccs.neu.edu)
Date: Mon Mar 23 11:55:28 EDT 2009

Thanks for the wrapper, and for the bug reports for the documentation.
 I've committed the wrapper, and changed the docs (including adding
documentation for `tar-gzip').

sam th

On Wed, Feb 25, 2009 at 8:23 PM, YC <yinso.chen at gmail.com> wrote:
> Hi Sam,
>
> Below is the wrapper for file/tar.  I found a few discrepancies from the
> doc:
>
> both tar and tar->output returns a exact-nonenegative-integer? instead of
> void? (due to the last call being (write-bytes ...)), so I had them return
> Integer
> tar->output takes (listof path?) instead of (listof path-string?)
> tar-gzip is missing from the doc but is available in mzlib/tar (from which
> file/tar imports), so I export it as well, and it actually returns void?
> this time
>
> Also I didn't find a way to write optional parameters so I used
> case-lambda.  Let me know if there is another way to write it.  (What would
> be the way to write keyword parameter then?)
>
> Thoughts?
>
> #lang typed-scheme
> ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;; tar.ss
> ;; typed-scheme wrapper on file/tar
> ;; yc 2009/2/25
> ;; licensed in LGPL, the same license as PLT Scheme itself.
>
> ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;; basic type aliases.
> (define-type-alias Path-String (U Path String))
>
> (require/typed file/tar
>                ;; tar appears to return exact-nonenegative-integer? instead
> of void?
>                (tar (Path-String Path-String * -> Integer))
>                ;; tar->output appears to take (listof path) instead of
> (listof path-string?)
>                ;; it also appears to return exact-nonenegative-integer?
>                (tar->output (case-lambda ((Listof Path) -> Integer)
>                                          ((Listof Path) Output-Port ->
> Integer)))
>                ;; tar->gzip
>                ;; missing from file/tar but available in mzlib/tar
>                ;; actually returns void?
>                (tar-gzip (Path-String Path-String * -> Void))
>                )
>
> (provide tar tar->output tar-gzip)
>
>
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-dev
>
>



-- 
sam th
samth at ccs.neu.edu


Posted on the dev mailing list.