-
Notifications
You must be signed in to change notification settings - Fork 26
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
add option types to encore #223
Conversation
All my previous issues have been resolved, but I stumbled upon a weird thing:
This program throws the compiler into an infinite loop somewhere in the typechecker (use the |
tuplecheck parentType (x, y) = do | ||
x' <- typecheck x | ||
y' <- typecheck y | ||
tuplecheck parentType (x', y') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This case looks suspicious (re: infinite loop)
addition of option types to encore. there is a type constructor called `Maybe t` which represent the option type. valid data constructors for option types are `Just t` and `Nothing`. there are some examples in the file `maybeType.enc`. a small example would be: def test_catch_all(z: Maybe int): string match z with z => "catchall" Just 32 => "Error, general condition should have been catched first" this is translated to c into a bunch of if-else statements. i mean a bunch because the developer can match on nested option types of the form `Maybe (Maybe int)`. restrictions: - there is not match all clause in the `match` expression
fix typechecking an expression which is not an option type or a var access
f0d23fb
to
6c1a1f2
Compare
While we are on this, why is word |
@albertnetymk I think you are in the wrong PR? |
Sorry, wrong tab. |
addition of option types to encore. there is a type constructor called
Maybe t
which represent the option type. valid data constructors for option
types are
Just t
andNothing
. there are some examples in the filemaybeType.enc
. a small example would be:this is translated to c into a bunch of if-else statements. i mean a
bunch because the developer can match on nested option types of the form
Maybe (Maybe int)
.restrictions:
match
expression