[plt-dev] typed scheme/path
harsha wrote:
> Below is typed scheme/path,
> The typed version of normalize-path doesn't allow an optional argument.
Note that you can do this using the case-lambda type constructor:
[normalize-path
(case-lambda (Path-string -> Path)
(Path-string Path-string -> Path))]
By the way, shouldn't these instances of Path-string really be Path/str?
This program works fine:
#lang scheme
(require scheme/path)
(path? "foo")
(string? "foo")
(normalize-path "foo")
(path? (current-directory))
(string? (current-directory))
(normalize-path (current-directory))
David
> ; path.ss
> ; LGPL licensed
>
> #lang typed-scheme
>
> (define-type-alias Path/str (U Path String))
> (define-type-alias Path-string String)