[racket] [typed] optional parameter
On 11/11/2011 11:02 AM, Sam Tobin-Hochstadt wrote:
> Unfortunately, Typed Racket needs a little more help from the
> programmer here. This will work:
>
> #lang typed/racket
> (: g (case-> (-> Number)
> (Number -> Number)))
> (define (g [#{x : Number} 10]) x)
>
> I hope to make what you wrote work eventually, but it doesn't yet.
I think this solution does not work if you are using modules. For example:
(module my-module typed/racket
(: g (case-> (-> Number)
(Number -> Number)))
(define (g [#{x : Number} 10]) a)
)
The type-checker says:
"define: not an identifier, identifier with default, or keyword for
procedure argument in: (#(x : Number) 10)"
Do I need a extra piece of code If I want to use a function with
optional parameters inside of a module?
Thank you,
Paul Leger.
--
Saludos, Paul Leger.