Sorry if the question isn't too clear. I'm not sure the best way to phrase it (feel free to edit!). I think an example would be the most clear:
I am attempting to define a Monad concept based off of the Haskell definition. The bind operator (>>=
) requires that a Monad
of type A
can be bound to a function that takes an A
and returns a Monad
of type B
. I can define A
in terms of a value_type
typedef but how do I define type B
in my concept?
template <typename M>
concept bool Monad()
{
return requires(M m, Function<_1, ValueType<M>> f) {
// (>>=) :: m a -> (a -> m b) -> m b
{ m >>= f } -> M
}
}
In the above example, what do I put in place of the _1
in the Function<> concept?
Also does this sufficiently constrain the result of invoking f to be a Monad of any type?