Skip to content

Shouldn't IO::bind be lazy? #27

@OlexandrPopov

Description

@OlexandrPopov

Consider the following code:

use Chemem\Bingo\Functional\Functors\Monads\IO;

$io = IO::of(function () {
    echo 'LOG 1', PHP_EOL;
})
->bind(function () {
    return IO::of(function () {
        echo 'LOG 2', PHP_EOL;
    });
});

It prints LOG 1 even $io->exec() is not called.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions