[plt-scheme] A new version of Typed Scheme

From: keydana at gmx.de (keydana at gmx.de)
Date: Thu Feb 25 14:52:56 EST 2010

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...)

What I would guess is that this system of "unions of structures (or simple types)" has the advantage of always keeping the type information (with predicates like leaf? or tree?), whereas as I understood Matthias' post in the other thread, I could possibly lose this information in the other system (in case of overlapping types).
Would this mean that if an algebraic define-type was added, it would be implemented in a completely different way (not with, e.g., a macro, as in Dave Herman's planet package)?


Posted on the users mailing list.