[plt-scheme] A new version of Typed Scheme

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Wed Feb 24 16:25:08 EST 2010

On Wed, Feb 24, 2010 at 4:03 PM, keydana at gmx.de <keydana at gmx.de> wrote:
> Hi,
> I've read the new Guide and find it much more helpful than the original one (which left me with many questions I must admit :-) )
> Just one thing (hopefully it doesn't sound too stupid):
> When reading, what surprised me was to find that e.g. True and False are both types, every symbol is a type... then I continued, reading about union types and subtyping, and now I'd be curious to ask if the whole type system is implemented as a hierarchy of unions, so something like
> (define-struct: Boolean (U True False))

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

> would be the scheme way of doing Haskell's
> data Bool = False | True

The difference between the Haskell code and the Typed Scheme code is
that the Haskell code introduces new values, unrelated to any others.
The type alias I've given is just a new name for the union type, and
other overlapping unions can also be created.

> In general, I wonder would it be possible to add a short introduction regarding concepts / implementation (for sure a detailed explanation of the concepts behind typed scheme do not belong in a guide, but ....)

I've wanted to write this, but I think it belongs in a separate
document, not as part of the guide.
sam th
samth at ccs.neu.edu

Posted on the users mailing list.