datatype
datatype copied to clipboard
Option datatype?
How might I define datatypes that take a type parameter, like Option?
Would like to be able to define Option like this, but currently can't:
(define-datatype (Opt a)
[Some (a)]
[None ()])
Thoughts?
So, at the moment w/ 'define-datatype' you cannot define a polymorphic datatype like (Opt a) -- this is only because I overlooked this feature (oops) as I was hacking together the basic features. It should be an easy addition since it's just riding on top of Racket's structs and they support type variables already.
I'll probably find some time to sit down and add this before next week now that finals are over (yay!).