[plt-scheme] check-expect and Typed Scheme
On Thu, Sep 04, 2008 at 09:31:22AM -0400, Matthias Felleisen wrote:
>
> I tend to move the inject function into the Typed Scheme
> module:
>
>
> (: to-keyevent (Any -> KeyEvent))
> (define (to-keyevent x)
> (if (keyevent? x) x (error 'to-keyevent "shouldn't happen: ~s" x)))
Oh, of course. I'd forgotten that Typed Scheme uses the predicate in the
conditional to restrict the type of x in the first branch of the if. Given
that, putting the injection functions into the typed module makes sense,
because untyped clients are unlikely to use them (especially if the untyped
modules use contracts).
Can you write the projections in Typed Scheme, though? Or do those still
have to be in the untyped world?
Richard