Skip to content
/ fyrfyrfyr Public

Basic tools for composing functions, to write simpler and safer programs

License

Notifications You must be signed in to change notification settings

ikr/fyrfyrfyr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

77 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

About

Basic tools for composing functions, to write simpler and safer programs in PHP 5.4+. Heavily inspired by @drboolean's book, the Ramda library, and the Fantasy Land JS project.

fox logo

Why?

This library grew out of frustration with old PHP code I have to maintain. I'm convinced that functional programming can lead us Out of the Tar Pit. I do know about Phamda and Pramda; very cool projects, but they both require PHP 5.6+. Then, I was also not 100% on board with some design choices those 2 make. I'd like to keep fyr-fyr-fyr tiny and lean, away from all sorts of cruft and magic. In many ways that's a matter of taste though.

API

Constructing functions

Composition

(f⋅g⋅h)(x) <-> f(g(h(x)))

Currying

f(x, y) <-> f(x)(y)

Flipping the arguments

flip

Primary higher order functions

map
chain
reduce
converge

Associative arrays

assoc
assocPath
fromPairs
merge
mergeAll
pick
pickAll
prop
propOr

Lists

append
indexBy
minBy

Utilities

add
always
identity
inc

Algebraic structures

IO
Maybe

Status: WORK IN PROGRESS

Not yet ready for using in production

About

Basic tools for composing functions, to write simpler and safer programs

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages