grrr-amsterdam / garp-functional
Utility library embracing functional programming paradigms.
Installs: 105 424
Dependents: 8
Suggesters: 0
Security: 0
Stars: 31
Watchers: 4
Forks: 4
Open Issues: 1
Requires
- php: >=7.2.0
Requires (Dev)
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^7.0 | ^9.5
- squizlabs/php_codesniffer: ^3.5
- dev-main
- v6.2.0
- v6.1.0
- v6.0.0
- v5.0.3
- v5.0.2
- v5.0.1
- v5.0.0
- v4.0.2
- v4.0.1
- v4.0.0
- v3.1.1
- v3.1.0
- v3.0.2
- v3.0.1
- v3.0.0
- v2.0.7
- v2.0.6
- v2.0.5
- v2.0.4
- v2.0.3
- v2.0.2
- v2.0.1
- v2.0.0
- v1.0.17
- v1.0.16
- v1.0.15
- v1.0.14
- v1.0.13
- v1.0.12
- v1.0.11
- v1.0.10
- v1.0.9
- v1.0.8
- v1.0.7
- v1.0.6
- v1.0.5
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- v0.1.13
- v0.1.12
- v0.1.11
- v0.1.10
- v0.1.9
- v0.1.8
- v0.1.7
- v0.1.6
- v0.1.5
- v0.1.4
- v0.1.3
- v0.1.2
- v0.1.1
- v0.1.0
- dev-functors
- dev-php71-update
- dev-lenses
This package is auto-updated.
Last update: 2024-10-26 13:31:37 UTC
README
Garp Functional
Utility library embracing functional programming paradigms.
Developed with ❤️ by GRRR
Philosophy
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_map
,array_filter
and the like, without having to create a closure around the call. - Higher-order functions are provided to fill the gaps. Functions like
compose
,partial
,partial_right
ornot
are 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 aTraversable
object into the nativearray_map
. - Typeclasses are added, broadening the applicability of the functions. Next to primitives, they will now work with your objects as well, so long as they implement the right interface.
Usage
Installation:
composer require grrr-amsterdam/garp-functional
That'll do, all functions are available to you.
Read the docs for a complete reference
Thanks
This library is inspired by beautiful languages like Haskell and Clojure,
as well as the awesome RamdaJS library.