[plt-dev] typed scheme/path

From: David Van Horn (dvanhorn at ccs.neu.edu)
Date: Fri Feb 27 19:31:03 EST 2009

harsha wrote:
> i just went back and checked and Path type doesn't include 
> Path-for-some-system
> (string->some-system-path "file" 'windows) fails to type check as its 
> output is supposed to be Path, but it returns a windows-path (i am on unix).

You can do the following:

#lang typed-scheme
(require/opaque-type Some-System-Path path-for-some-system? scheme)
(require/typed scheme/path
                 (String (U 'windows 'unix) -> Some-System-Path)])

(string->some-system-path "file" 'windows)


Posted on the dev mailing list.