Skip to content

Commit 0df237d

Browse files
committed
refactor(docs): use propagate_error for flatten example
1 parent 2cb49a7 commit 0df237d

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

docs/design_rationale.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,12 +218,11 @@ zero changes to the library or to the box types.
218218
template <beman::monadics::box Box>
219219
requires beman::monadics::box<typename beman::monadics::get_box_traits<Box>::value_type>
220220
constexpr auto flatten(Box&& box) {
221-
using Traits = beman::monadics::get_box_traits<Box>;
222-
using InnerBox = typename Traits::value_type;
223-
using ITraits = beman::monadics::get_box_traits<InnerBox>;
221+
using Traits = beman::monadics::get_box_traits<Box>;
222+
using InnerBox = typename Traits::value_type;
224223
225224
if (!Traits::has_value(box))
226-
return ITraits::make_error(Traits::error(std::forward<Box>(box)));
225+
return beman::monadics::propagate_error<InnerBox>(std::forward<Box>(box));
227226
return Traits::value(std::forward<Box>(box));
228227
}
229228
```

0 commit comments

Comments
 (0)