2
0
mirror of https://github.com/boostorg/hana.git synced 2026-02-01 20:42:13 +00:00

Add the MonadPlus concept

This commit is contained in:
Louis Dionne
2015-02-17 08:54:28 -05:00
parent 9706eef852
commit 272ffa7900
27 changed files with 1789 additions and 743 deletions

View File

@@ -64,6 +64,24 @@ BOOST_HANA_CONSTEXPR_CHECK(flatten(just(just(2))) == just(2));
}{
//! [monad_plus]
BOOST_HANA_CONSTEXPR_CHECK(
concat(nothing, just('x')) == just('x')
);
BOOST_HANA_CONSTANT_CHECK(
concat(nothing, nothing) == nothing
);
BOOST_HANA_CONSTEXPR_CHECK(
concat(just('x'), just('y')) == just('x')
);
BOOST_HANA_CONSTANT_CHECK(nil<Maybe>() == nothing);
//! [monad_plus]
}{
//! [traversable]
BOOST_HANA_CONSTEXPR_LAMBDA auto replicate3 = [](auto x) {
return tuple(x, x, x);