aol/cyclops

Maybe filter is not executed lazily

johnmcclean opened this issue · 1 comments

Describe the bug
Calling filter on a Maybe Just instance (i.e. a lazy Maybe with a value that is present), results in filter being executed immediately.

To Reproduce

          Maybe.just(10)
                 .filter(i->{
                     lazy = false;
                     return i>10;
                 });

            assertTrue(lazy);

Expected behavior
The predicate passed to filter should be called until a terminal operation on Maybe is called.

Screenshots / test / examples
See test example above.

Additional context
Also will impact LazyEither.filter as this delegated to Maybe.filter

Merged