Skip to content

Conversation

@bash
Copy link
Member

@bash bash commented Jan 24, 2025

I don't know if we already knew this but passing a method group to an identity function helps infer its natural type. This makes using our function and action extensions much more attractive.

To help with the readability I propose an alias for the Identity function called Fn.

before:

var pow = Curry(Math.Pow);
//        ^^^^^
// error CS0411: The type arguments for
// method 'Functional.Curry<...>' cannot
// be inferred from the usage.

after:

var pow = Curry(Fn(Math.Pow));
// or
var pow = Fn(Math.Pow).Curry();
// or with Apply:
var expTwo = Apply(Fn(Math.Pow), 2, __);

@bash bash requested a review from FreeApophis January 24, 2025 12:56
@bash bash enabled auto-merge January 24, 2025 12:56
@bash bash merged commit 180c4bc into main Jan 27, 2025
9 checks passed
@bash bash deleted the func branch January 27, 2025 13:35
@FreeApophis
Copy link
Member

FreeApophis commented Jan 27, 2025

Funny, I tried that before and I thought it didn't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants