[racket] Problems with Typed Racket

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Sat Apr 9 18:34:37 EDT 2011

On Sat, Apr 9, 2011 at 5:24 PM, Sam Tobin-Hochstadt <samth at ccs.neu.edu> wrote:
> On Sat, Apr 9, 2011 at 5:50 PM, Renzo Orsini <renzo.orsini at gmail.com> wrote:
>> I was trying Typed Racket for the first time.
>>
>> when I do "Check Syntax" on the following function (which in a (untyped) Racket program works correctly) (I simplified the real function):
>>
>> #lang typed/racket
>>
>> (: elaborate (String String -> Any))
>> (define (elaborate in-path-name out-path-name)
>>  (let ([out-path (string->path out-path-name)])
>>        (call-with-output-file out-path #:exists 'replace
>>          (lambda(out-file)
>>            (list out-file)))))
>>
>> the following error message is shown: "for: expected a sequence for (v r), got something else: #f"
>
> This seems to be a bug in Typed Racket.
>
>> If I omit #:exists 'replace
>> then the message becomes (notes that in the reference manual it is said that call-with-output file expects a path as first parameter):
>>
>> <unsaved editor>:6:8: Type Checker: Polymorphic function call-with-output-file could not be applied to arguments:
>> Argument 1:
>>  Expected: String
>>  Given:    Path

Is this part of the error message somehow wrong? Shouldn't it expect
whatever typed racket calls things that pass the path-string?
predicate?

Robby

>> Argument 2:
>>  Expected: (Output-Port -> a)
>>  Given:    (Any -> (List Any))
>>
>> Result type:     a
>> Expected result: Any
>>  in: (call-with-output-file out-path (lambda (out-file) (list out-file)))
>
> You need to annotate your `lambda' with a type for `out-file'.  See
> `lambda:' in the documentation.
> --
> sam th
> samth at ccs.neu.edu
>
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
>



Posted on the users mailing list.