Closed phkiener closed 3 years ago
Hey, former digitec employee here, great effort you put into your open source libraries. We at @messerli-informatik-ag, where I am currently CTO, have built a very very similar and fast growing library: Funcky
We already have Flip, Curry, Identity, NoOp ... etc.
We also try to add API to the .NET Standard Library which promotes the functional programming style e.g.:
"1234".TryParseInt()
which returns an Option<int>
We also try to make the different Monads like Option<T>
IEnumerable<T>
(linq syntax) Task<T>
(await
) Lazy<T>
work nicely together.
With Funcky you can do this:
var date =
from year in yearString.TryParseInt()
from month in monthString.TryParseInt()
from day in dayString.TryParseInt()
select new DateTime(year, month, day)
We would like to invite you to take a look if the library could offer you something, or even combine our efforts. Because we know how much work it is and we also think ideas need to be challenged to become great.
This issue has been open for quite some time, and I've had quite some time to think about it.
While I did open a PR, I have closed it now. With how the library currently is, these helpers would stand out like a sore thumb.. a whole new concept to be introduced.
For now, I'll close this issue. Maybe some time in the future we'll introduce all this fancy stuff, but for now - let's keep it at Option, Result and Either.
Right now, the package is mostly focused on Option, Result and Either. It'd be nice to include some miscellaneous functions to ease working with lambdas everywhere...
Func<T2, T1, T3> Flip<T1, T2, T3>(Func<T1, T2, T3>)
Func<T, Unit> Do<T>(Action<T>)
T Identity(T)
Func<T> Const<T>(T)
Func<T1, T3> Compose<T1, T2, T3>(Func<T1, T2>, Func<T2, T3>)
Func<T2, T3> Bind<T1, T2, T3>(Func<T1, T2, T3>, T1)
And because of the beauty that is functional programming, the types should be enough to explain what the functions should do.