spebbe / dartz

Functional programming in Dart
MIT License
749 stars 60 forks source link

[Doubt] where was declared and implemented the functions ifRight and ifLeft? #96

Closed igotfr closed 2 years ago

igotfr commented 2 years ago

where was declared and implemented the functions ifRight and ifLeft?

spebbe commented 2 years ago

Hi @cindRoberta!

I'm afraid I don't really understand your question. In case you are referring to the named arguments ifLeft and ifRight to Either#fold then those are just names of function arguments that callers are supposed to supply.

Please supply more context if you meant to ask about something different!

igotfr commented 2 years ago
B fold<B>(B ifLeft(L l), B ifRight(R r));

is a syntax sugar for:

B fold<B>(B Function(L l) ifLeft, B Function(R r) ifRight);