grain
grain copied to clipboard
Will function overloading be supported?
Hi!
I'm just curious if Grain is planning on supporting function overloading?
The main reason I'm interested in overloading is for creating functions that can act as "data-first" when given all the params and also act as "data-last" when not given the data to operate on. This is useful for a number of things but is particularly nice when piping. If List.map
was overloaded as described (and we had a pipe
function defined somewhere), we could do:
let myList = [1, 2, 3]
let result1 = List.map((x) => x*2, myList) // [2, 4, 6]
// or
let result2 = pipe(
myList,
List.map((x) => x*2),
) // [2, 4, 6]
I'm not sure of the difficulties this makes for the type system however.
Also, as an unrelated thing, I'm interested in participating in Grain's Discord server but I don't want to give my phone number to Discord. Is there a way to verify without having to give up my phone number?
I also don't use Twitter or similar social media sites and Grain doesn't have any official email channel so I'm very cut off from the community right now (I think GitHub Issues are the only way for me to communicate at the moment).
Thanks!