-
Notifications
You must be signed in to change notification settings - Fork 0
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
[new] Allow pattern matching in lambdas, and compile constructors #22
Conversation
Co-authored-by: Alan Lawrence <[email protected]>
brat/Brat/Checker.hs
Outdated
@@ -419,6 +487,73 @@ check' (Simple tm) ((), ((hungry, ty):unders)) = do | |||
pure (((), ()), ((), unders)) | |||
check' tm _ = error $ "check' " ++ show tm | |||
|
|||
|
|||
-- Clauses from either function definitions or case statements (TODO), as we get |
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.
Think this TODO is bogus now? The TODO was this PR! :)
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.
Fixed!
qpred None = Nothing | ||
qpred One = Just None | ||
qpred Tons = Just Tons | ||
data Quantity = None | One | Tons deriving (Enum, Show) |
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.
Some day we can move this, but let's not bother now
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.
🎉 🚀
Allow lambda expressions to have multiple clauses employing pattern matching logic just like what is done for top level definitions. This improves expressiveness as previously we couldn't pattern match in kernels that were defined as lambdas created by classical functions.
These multi-clause lambda expressions - "multilambdas" - are parsed inside curly braces, as many lambda expressions separated by a
|
.Closes #8, #17