Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option datatype? #2

Open
markfarrell opened this issue May 7, 2015 · 1 comment
Open

Option datatype? #2

markfarrell opened this issue May 7, 2015 · 1 comment

Comments

@markfarrell
Copy link
Collaborator

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?

@pnwamk
Copy link
Owner

pnwamk commented May 7, 2015

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants