[racket] Problems with Typed Racket
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"
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
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)))
Am I doing something wrong?
Or Typed Racket is an experimental feature?
Thanks very much for your help!
Renzo