[racket-dev] typed/scheme n00b question

From: Hari Prashanth (krhari at ccs.neu.edu)
Date: Sun Sep 5 12:02:25 EDT 2010

Since secs and and fail-thunk are optional, we need to use case lambda for writhing
the type.

(require/typed racket/base
                  [String -> (U Integer Void exn:fail:filesystem)]
                  [String (-> exn:fail:filesystem) -> (U Integer Void exn:fail:filesystem)]
                  [String (Option Integer) (-> exn:fail:filesystem) 
                          (U Integer Void exn:fail:filesystem)])])

* If we do not have exn:fail:filesystem, it will raise a contract-broken error when 
fail-thunk raises an exception. So I added exn:fail:filesystem.

So how can I have the exception and not the contract error?


----- Original Message -----
From: "Shriram Krishnamurthi" <sk at cs.brown.edu>
To: "Sam Tobin-Hochstadt" <samth at ccs.neu.edu>
Cc: "Hari Prashanth" <krhari at ccs.neu.edu>, "plt-dev Developers" <dev at lists.racket-lang.org>
Sent: Sunday, September 5, 2010 9:59:32 AM GMT -05:00 US/Canada Eastern
Subject: Re: [racket-dev] typed/scheme n00b question

Can you tell us (om the list) what the true type is?  I'm sure I'm not
the only one curious as to precisely what it is and how you would
write it w/ the exception.  Thanks.


On Sun, Sep 5, 2010 at 8:57 AM, Sam Tobin-Hochstadt <samth at ccs.neu.edu> wrote:
> On Sun, Sep 5, 2010 at 3:06 AM, Hari Prashanth <krhari at ccs.neu.edu> wrote:
>> Is this what you are looking for?
>> (require/typed racket/base
>>               [file-or-directory-modify-seconds
>>                (String (Option Integer) (-> exn:fail:filesystem) -> (U Integer Void))])
> Hari is correct that you can use `require/typed' on `racket/base'.
> However, that type isn't quite right - it shouldn't *return*
> `exn:fail:filesystem' - that is an exception that might be raised.
> The true type is more complex; I'll add it to the base environment.
> --
> sam th
> samth at ccs.neu.edu
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/dev

Posted on the dev mailing list.