[plt-dev] Re: typed scheme/path - new adapter for scheme/path

From: harsha (harsha.v.r at gmail.com)
Date: Sat Feb 28 10:31:33 EST 2009

;path.ss
;LGPL licensed

#lang typed-scheme

(require/opaque-type Path-for-some-system path-for-some-system? scheme)
(define-type-alias String/Path-for-some-system (U String
Path-for-some-system))
(define-type-alias String/Path (U String Path))

(require/typed scheme/path
               [find-relative-path (String/Path-for-some-system
String/Path-for-some-system -> Path-for-some-system)]
               [explode-path (String/Path-for-some-system -> (Listof (U
Path-for-some-system 'up 'same)))]
               [simple-form-path (String/Path -> Path)]
               [normalize-path
                (case-lambda (String/Path -> Path)
                             (String/Path String/Path -> Path))] ;second
argument can be made more expressive by using a complete-path opaque type
               [filename-extension (String/Path-for-some-system -> (Option
Bytes))]
               [file-name-from-path (String/Path-for-some-system -> (Option
Path-for-some-system))]
               [path-only (String/Path-for-some-system ->
Path-for-some-system)]
               [some-system-path->string (Path-for-some-system -> String)]
               [string->some-system-path (String (U 'unix 'windows) ->
Path-for-some-system)])

(provide find-relative-path
         explode-path
         simple-form-path
         normalize-path
         filename-extension
         file-name-from-path
         path-only
         some-system-path->string
         string->some-system-path)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/dev/archive/attachments/20090228/9f07f8e0/attachment.html>

Posted on the dev mailing list.