dkormalev / cefal Goto Github PK
View Code? Open in Web Editor NEW(Concepts-enabled) Functional Abstraction Layer for C++
License: BSD 3-Clause "New" or "Revised" License
(Concepts-enabled) Functional Abstraction Layer for C++
License: BSD 3-Clause "New" or "Revised" License
(This is not necessarily an issue).
The way that the various type classes are implemented all look basically like this:
template <typename T1, typename T2>
static std::optional<M> append(T1&& left, T2&& right) {
static_assert(std::is_same_v<std::remove_cvref_t<T1>, std::optional<M>>, "Argument type should be the same as monoid");
static_assert(std::is_same_v<std::remove_cvref_t<T2>, std::optional<M>>, "Argument type should be the same as monoid");
Is there a reason you chose unconstrained arguments with a static_assert
, as opposed to an implementation strategy like:
template <DecaysTo<std::optional<M>> T1, DecaysTo<std::optional<M>> T2>
static std::optional<M> append(T1&& left, T2&& right) {
// no static_asserts
}
The former might give you better diagnostics for direct invocations, the latter lets you "bubble up" the constraint to catch it earlier in the call stack.
Hello,
this project is a very nice idea. Thank you for sharing.
I have read the readme file and was left wondering about your definition of functor. What is unit and which laws does it obey. Furthermore, I am asking myself how a type can satisfy functor+monoid. You mentioned this in the from optional conversion. I am asking, because the kind of functor is * -> * and that of monoid is *.
Kind regards
Konstantin
Ps, since you like functional programming. Try coroutines. You can implement some monadic bindings with it. However, a general monad seems to be not possible. At least I found no way to clone the state of a coroutine. This would be required to invoke the continuation more than one time as for the list monad for example.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.