[Haskell-cafe] ANN: monad-bool 0.1

Alexander Kjeldaas alexander.kjeldaas at gmail.com
Wed Jan 23 09:00:50 CET 2013


If we step back, I think the lesson here is that Haskell libraries exist,
but the concepts are far enough from what you expect to exist given
background knowledge from another programming language.

So what is actually needed is not monad-bool, but the equivalent
documentation that makes a programmer which is not an expert in Haskell
connect the dots like you did today.

Alexander



On Wed, Jan 23, 2013 at 8:10 AM, John Wiegley <johnw at fpcomplete.com> wrote:

> >>>>> John Wiegley <johnw at fpcomplete.com> writes:
>
> > Never mind, when/unless + left work just fine for this.
>
> You know, it's been a humorous day.
>
> First ekmett showed that I can't make a sane Monad instance for AndM or
> OrM.
>
> Then I discovered I can't make a reasonable Monoid (no mempty, given only
> 'toBool'), so I dropped down to a Semigroup.  Further, my combinators for
> EitherT can be implemented using just 'when' and 'left' to provide the
> short-circuiting.
>
> Already I had very little code left, until he showed me the Applicative
> instance for Either, plus a little trick:
>
>     >>> Right 1 *> Right 2 *> Left 2 *> Right 5
>     Left 2              -- same functionality as my And semigroup
>
>     >>> let Left x |> y = y; x |> _ = x in Left 1 |> Right 2 |> Right 3
>     Right 2            -- same functionality as my Or semigroup
>
> And poof, all my code just disappeared...
>
> --
> John Wiegley
> FP Complete                         Haskell tools, training and consulting
> http://fpcomplete.com               johnw on #haskell/irc.freenode.net
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130123/4782b729/attachment-0001.htm>


More information about the Haskell-Cafe mailing list