|
Boost : |
Subject: Re: [boost] Monad (was: Re: [Boost-users] [afio] Formal review of Boost.AFIO)
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2015-08-25 08:25:19
On 25 Aug 2015 at 0:30, Sam Kellett wrote:
> > Monad has all those items you mention. See
> > https://ned14.github.io/boost.monad/singletonboost_1_1monad_1_1basic__
> > monad.html under the section "Functional programming extensions
> > (optional)".
> >
> > You also get to customise them to your heart's content via the policy
> > class infrastructure. After all, basic_future<> which subclasses
> > basic_monad<> implements binds as continuations.
>
> that does look good, don't get me wrong. but would i be able to use it to,
> say, provide monadic options to std::list? or io ala haskell? because if
> not i would wonder why not simply because it's called 'monad'.
>
> what if i wanted to use the >> operator on a boost::optional, could i do
> that with your monad type?
Monad only provides monadic operations to monad<T>. So
monad<std::list<T>> works as expected, and it is very cheap (often
completely zero cost) to wrap any type U into monad<U>.
> i'm sure i'm being dense, but i couldn't find an example of the policy
> infrastructure so i couldn't answer those questions myself.
Documenting all that would take at least three months. Hence why
Monad is not ready for review.
Niall
-- ned Productions Limited Consulting http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk