FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Refine properties inside Bindable · Issue #4 · fp4php/fp4php · GitHub

/ fp4php Public

Refine properties inside Bindable #4

Description

<?php

declare(strict_types=1);

use Fp4\PHP\Option as O;

use function Fp4\PHP\Combinator\pipe;

/** @var string|int */
$stringOrNumber = 'str';

// current type is: Option<Bindable<object{a:int|string}>>
// should be is: Option<Bindable<object{a:string}>>
$_ = pipe(
    O\bindable(),
    O\let(a: fn() => $stringOrNumber),
    O\filter(fn($i) => is_string($i->a)),
);

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


Back | FazBrowse Home | New Git URL