Comments (2)
It's necessary to preserve function signatures in some cases. Given some function-like type F
, there's no way of figuring out which argument type(s) it expects. However, given a function<B(A)>
, we know it expects an A
and returns a B
.
I'm aware of the cost of this, though, and have tried to make sure that in every case where the function signature is not needed, the library accepts a template function type instead, eg
template<typename F, typename U = result_of<F(T)>>
static constexpr maybe<U> map(F f, maybe<T>&& m) {
return m.match(
[f](T& t){ return just(f(std::move(t))); },
[](Nothing){ return Nothing{}; }
);
}
Though honestly, all of the above is kind of moot, because I can't at this point recommend anyone to use the FTL. I haven't really kept up maintenance or development in over a year. For example, using C++14 features, the above could have forwarded f
into the closure instead of always copying it.
from ftl.
Boost has some utilities to infer sigbatures I think. So maybe I will try forking some time :). First have to learn Haskell though. Just started with "real world Haskell", good read :)
from ftl.
Related Issues (12)
- Truly generalised Functor, Applicative, and Monad
- Clang 3.4 and gcc 4.9 HOT 6
- Portable? HOT 6
- monoid defined in_terms_of_plus: typo HOT 1
- monoid defined in_terms_of_plus: are 0 and operator+ the good abstraction? HOT 2
- The fequal function HOT 2
- Any releases planned? HOT 3
- can not compile with visual studio 2017
- Should I first learn haskell adequately before using this library? HOT 3
- Contributing to ftl! HOT 7
- Clang 3.3's implementation of std::mem_fn is not const-friendly. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ftl.