Utility library embracing functional programming paradigms.
Garp\Functional is a practical functional library that strives to embrace functional paradigms.
- Functions are pure, referentially transparent, without side-effects.
- Data immutability is favored over mutating existing properties of given parameters.
- In general, functions are curried. Almost all of the functions in the library can be called partially applied, to a point where this makes sense.
- Function parameters are ordered to promote currying. Data is usually the last thing to go in,
making every function a fine candidate to pass to native
array_filterand the like, without having to create a closure around the call.
- Higher-order functions are provided to fill the gaps. Functions like
notare legos for you to use in your own implementation.
- Nothing is type-hinted too strictly. I don't care if you pass a
string or an array to
prop, as long as it allows accessing members thru bracket syntax
, I'll allow it. Nothing irks me more about PHP than not being able to toss a
Traversableobject into the native
composer require grrr-amsterdam/garp-functional
That'll do, all functions are available to you.