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

Type for rtl values #4

Closed
jkopanski opened this issue Aug 7, 2018 · 1 comment · Fixed by #7
Closed

Type for rtl values #4

jkopanski opened this issue Aug 7, 2018 · 1 comment · Fixed by #7

Comments

@jkopanski
Copy link
Owner

RTL values can be Valid or Invalid. Any operation involving Invalid value yields another Invalid.

Valid values can are characterized by its type (Ty or RTy). It would be nice to have basic set of typeclasses instances for those like Num or Bounded.

@jkopanski jkopanski created this issue from a note in Basic interpreter (In progress) Aug 7, 2018
@jkopanski
Copy link
Owner Author

While doing complex type for rtl expression like:

data Value :: Ty -> * where
  Value :: Sing t -> Int -> Value t

and later using it for expression evaluation, it occurred to me that this is much overkill.
Expressions carry type information that can be used to alter the result itself and typechecking is making sure that we won't actually need to clip and roll the resulting values.

I've decided to go with simple Int as expression value and use Maybe for its possible invalidity.

@jkopanski jkopanski moved this from In progress to Done in Basic interpreter Aug 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging a pull request may close this issue.

1 participant