[plt-scheme] check-expect and Typed Scheme

From: Sam TH (samth at ccs.neu.edu)
Date: Thu Sep 4 12:30:43 EDT 2008

On Thu, Sep 4, 2008 at 10:40 AM, Richard Cobbe <cobbe at ccs.neu.edu> wrote:
> 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?

Most likely not.  The only operations you have on an opaque type are
ones you require from other modules, so any project would have to be

sam th
samth at ccs.neu.edu

Posted on the users mailing list.