This repository has been archived by the owner on Aug 13, 2024. It is now read-only.
Function overloading #40
tiansivive
started this conversation in
Ideas
Replies: 1 comment
-
Proposed syntax could be: let overload
| Foo: (Int, Int) -> Int = \(x,y) -> x + y
| Bar: (String, Int) -> Int = \(x,y) -> read x + y
| Baz: (Int, String) -> Int = \(x,y) -> x + read y
| Curried: Curry (String, Int) -> Int = \x y -> x + y
There could be potential conflicts with normal type expression parsing.
Assuming there are answers to all of the above, this would be resolved by the Elaboration process, where determining the types of an application of |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
By taking advantage of type unions, we can introduce function overloading.
This can be useful for having different APIs, for example, curried vs uncurried versions or different parameter order for readability purposes
Beta Was this translation helpful? Give feedback.
All reactions