[plt-scheme] A new version of Typed Scheme
On Thu, Feb 25, 2010 at 2:52 PM, keydana at gmx.de <keydana at gmx.de> wrote:
> Hi Sam,
>
> thanks for the explanation.
>
>
>>>
>>
>> This is close to right. There's no struct for Booleans. In Typed
>> Scheme, it would look like this:
>>
>> (define-type-alias Boolean (U True False))
>
>
> Oh yes, I meant to write that (or at least pretend this now :-; )
>
> I hope I'm not getting on everybody's nerve too much, but now that I'm at it... I wonder how far it would be from
>
> (define-struct: None ())
> (define-struct: (a) Some ([v : a]))
> (define-type-alias (Opt a) (U None (Some a)))
>
> to having a define-type for algebraic datatypes as discussed in another recent thread ("typed scheme vs. PLAI types")? (On the surface, it looks as if there'd be just some kind of "compression" needed...)
Not far at all - macros for algebraic datatypes in Scheme generally
expand into code just like that, and in Eli Barzilay's PL course, we
use a version of Typed Scheme which supports them, one that I hope to
add to PLT in general soon.
--
sam th
samth at ccs.neu.edu