Back in the ’40s, Samuel Eilenberg and Saunders Mac Lane started developing an entire new branch of mathematics: Category Theory. This was 10 years after Lambda calculus and 10 years before Lisp. Mathematics offers a powerful and concise language; we can represent a lot of complexity with short equations like E=mc2.
This session will explore how programming can harness maths’ capacity for conciseness and expression, borrowing from Category Theory. We’ll discover algebraic data types that can impact the way we code tremendously. You’ll also learn about functors, monads, applicatives, semigroups and monoids and how they can be used in a PHP context.
31. @_md#phpbnl17
interface Monoid extends Semigroup {
public function zero();
// inherited from Semigroup
public function combine($another);
}
class Balance implements Monoid { // ... }
58. @_md#phpbnl17
interface Apply extends Functor
{
public function apply($ff);
public function map2($fb, callable $f);
}
interface Applicative extends Apply
{
public function pure($a);
}