[racket] Problems with Typed Racket

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Mon Apr 11 08:26:44 EDT 2011

On Mon, Apr 11, 2011 at 4:15 AM, Renzo Orsini <renzo.orsini at gmail.com> wrote:
> Hello again,
> 1) If the first case is a bug, should I file it in some bug tracker system?

Yes.  The best way to file bugs is to use the "Report a Bug" feature
in DrRacket, available in the Help menu.

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

Rather than 'port', you mean 'path' here, but otherwise you're
correct.  This should be corrected momentarily.

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

I encourage you to use Typed Racket for this, and it should certainly
be stable enough for your project.

> 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

sam th
samth at ccs.neu.edu

Posted on the users mailing list.