[plt-dev] Typed Scheme: function type declarations should support optional args

From: Noel Welsh (noelwelsh at gmail.com)
Date: Mon Mar 29 09:31:36 EDT 2010

This common pattern

(define (foo a [b 1] [c 2] [d 3]) ...)

which expands into a case-lambda like

(define foo
  (case-lambda (([a] (foo a 1 2 3))
                        ([a b] (foo a b 2 3)) ...))

is a damn pain to type and Type in Typed Scheme. It would be really
nice it one could just write:

(: foo (Integer [Integer] [Integer] [Integer] -> Integer))
(define (foo a [b 1] [c 2] [d 3]) ...)

in Typed Scheme.


Posted on the dev mailing list.