nostriphant/functional

Functional helper classes for nostriphant projects

Installs: 846

Dependents: 4

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/nostriphant/functional

2.5.5 2026-02-11 10:23 UTC

This package is auto-updated.

Last update: 2026-02-11 10:24:19 UTC


README

Functional helper classes for nostriphant projects

Usage

use nostriphant\Functional\Alternate;

$state = Alternate::state1('Hello World!');

$evaluate = $state(state1: function (string $message) {
    yield $message;
});

foreach ($evaluate as $message) {
    expect($message)->toBe('Hello World!');
}

FunctionList

use nostriphant\Functional\FunctionList;

$list = new FunctionList(fn($x) => $x * 2);
$list2 = $list->bind(fn($x) => $x + 3);
expect($list2(2))->toBe([4, 5]);