libfn / functional

Extending C++ library for functional programming
ISC License
60 stars 8 forks source link

Use static_check util #25

Closed godexsoft closed 8 months ago

godexsoft commented 8 months ago

Fixes #23

All tests are now using static_check util. Not 100% sure about removing the few places we had clang-format disabled. It's not too bad as it is now but arguably was a little nicer before.

codecov[bot] commented 8 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 100.00%. Comparing base (34da4a2) to head (2137ca7). Report is 44 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #25 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 12 12 Lines 88 88 Branches 3 3 ========================================= Hits 88 88 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

Bronek commented 8 months ago

@godexsoft do you mind keeping the is_p and is_e tests in filter.cpp separate ? They do not work the same; error generator is a sink, but predicate is not (it can only read a value) and keeping these mixed creates confusing impression that they work the same. While doing so you might add more tests to is_p to see it in practice (no matter the type of operand, predicate won't bind a non-const lvalue-ref or rvalue-ref, but error generator will)

Bronek commented 8 months ago

Also, the "// lvalue operand" comments are misleading when the operand type has no & qualifier. These are prvalues, not lvalues. In case of binding to predicates parameter, we turn these to const lvalue (by means of std::as_const) , but predicate in filter (and also inspect) are unusual, since they are not sinks. Normal monadic operations are sinks and they would receive parameter as-is (which is what we use FWD(v) for, or someone else would write a little slower to compile and longer to type std::forward<decltype(v)>(v))

godexsoft commented 8 months ago

Also, the "// lvalue operand" comments are misleading when the operand type has no & qualifier. These are prvalues, not lvalues. In case of binding to predicates parameter, we turn these to const lvalue (by means of std::as_const) , but predicate in filter (and also inspect) are unusual, since they are not sinks. Normal monadic operations are sinks and they would receive parameter as-is (which is what we use FWD(v) for, or someone else would write a little slower to compile and longer to type std::forward<decltype(v)>(v))

That's a good observation. I will update accordingly.