[racket] Problems with Typed Racket

From: Renzo Orsini (renzo.orsini at gmail.com)
Date: Mon Apr 11 04:15:46 EDT 2011

Hello again,

1) If the first case is a bug, should I file it in some bug tracker system?

2) The second error maybe arises from the fact that in the documentation call-with-output-file is declared as taking either a string or a port, but for the type checker it should always take a string, not a port. Or I misunderstood the whole issue?

3)  I am looking for advice about using or not TypedRacket. For my past experience in designing, implementing and using static typed languages for databases I would prefer the typed version, but I would like to know if it is stable enough for a medium sized research project.

Thank you very much for all your help.


On Apr 10, 2011, at 24:34 , Robby Findler wrote:

> 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.