[Haskell-cafe] Contravariant applicatives, monads and arrows (was ANN: rematch, an library for composable assertions with human readable failure messages)

Roman Cheplyaka roma at ro-che.info
Thu Apr 18 00:57:19 CEST 2013


* Stephen Tetley <stephen.tetley at gmail.com> [2013-04-16 19:48:47+0100]
> On 16 April 2013 16:12, Alejandro Serrano Mena <trupill at gmail.com> wrote:
> > Hi,
> > First of all, let me say that this work on matchers is really useful :)
> >
> > Following Roman advice, I'm trying to find a more principled approach
> > that could be useful for this library. It seems that "Match" could
> > easily be converted to Either and thus made into Functor, Applicative,
> > Alternative and Monad. That would allow to write things like:
> >
> 
> 
> Have you seen Ralf Hinze, Johan Jeuring and Andreas Loeh's  paper on Contracts?
> 
> The found their Contract datatype formed a comonad - at the time this
> seemed to be one of the few (non-synthetic) uses of comonads.

Their Contract datatype is contravariant, just like Tom's Matcher. So it
cannot be a comonad.

It's their "contracted function" type which is a (very simple) comonad —
but I'm not sure how it can be useful here.

(I only skipped very quickly through the paper, so I may be missing
something.)

Roman



More information about the Haskell-Cafe mailing list