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

From: YC (yinso.chen at gmail.com)
Date: Wed Feb 25 15:23:15 EST 2009

Hi Sam,

Below is the wrapper for file/tar.  I found a few discrepancies from
the doc<http://docs.plt-scheme.org/file/tar.html>

   1. 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
   2. tar->output takes (listof path?) instead of (listof path-string?)
   3. 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?)


#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 ->
               ;; 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)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/dev/archive/attachments/20090225/7f5f647b/attachment.html>

Posted on the dev mailing list.