[plt-scheme] Case lambda in typed scheme

From: Carl Eastlund (carl.eastlund at gmail.com)
Date: Wed Mar 18 21:00:06 EDT 2009

On Wed, Mar 18, 2009 at 8:54 PM, Paulo J. Matos <pocmatos at gmail.com> wrote:
> While on an adventure to use typed-scheme I faced this issue:
> #lang typed-scheme
>
> (: foo (case-lambda [-> Symbol]
>                    [Symbol -> Symbol]))
> (define foo
>  (case-lambda [() 'foo]
>               [(s) s]))
>
> I can't see what might be wrong here. Still I get in 4.1.4:
> typecheck: untyped var: s in: s

I think you need to use case-lambda: (note the colon at the end of the
name), which will further require you to give s an explicit type.
Even though foo has a type, Typed Scheme does not infer the type of s
from that.  Every variable needs a type.

-- 
Carl Eastlund


Posted on the users mailing list.