-
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
Implement user-defined symbolic operators & uncurry all operator applications #177
Conversation
It seems that there are some parsing problems: fun (<<|+_+|>>) robot(a, b) = a + b
//│ fun (<<|+) robot: (Int, Int) -> Int
// should be `<<|+_+|>>`, but we got `<<|+`
fun (:-D) dd(a, b) = a + b
//│ fun (:-) dd: (Int, Int) -> Int
// should be `:-D`, but we got `:-` The parsed operators are not complete. If there is any unsupported symbol in the defined operators, maybe we can reject it in the parser. |
@NeilKleistGao Good catch! I've fixed the parsing bug (it was swallowing some erroneous tokens) and improved the error messages. |
When will we support emoji? 😁😄😃 Can't wait to use real magic wind 🪄 instead of |
@chengluyu Good suggestion! But the lexer currently says "unexpected character" :^( |
@NeilKleistGao @chengluyu Some parts of mlscript/shared/src/main/scala/mlscript/JSBackend.scala Lines 1364 to 1403 in 157c3e7
Because of this I couldn't easily tell why this one does not currently work: val (-->) f(x, y) = [x, y]
//│ let (-->) f: forall 'a 'b. ('a, 'b) -> ['a, 'b]
//│ f
//│ = [Function: f]
:ge // FIXME
12 --> 34
//│ [12, 34]
//│ Code generation encountered an error:
//│ unresolved symbol --> |
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.
LGTM.
Examples:
At the type level: