2011/12/26 Eugene Kirpichov <ekirpic...@gmail.com>

> Whoa. Sebastian, you're my hero — I've been struggling with defining Arrow
> for ListTransformer for a substantial time without success, and here you
> got it, dramatically simpler than I thought it could be done (I was using
> explicit queues).
>

This stuff is tricky. I noticed that my Applicative instance did not
satisfy all required laws. I think I could fix this by changing the
implementation of pure to

    pure x = Put x $ pure x

in analogy to the ZipList instance. At least, QuickCheck does not complain
anymore (I did not write proofs).

The original definition of `pure` was inspired by Chris Smith's post on the
connection of Category/Applicative and Arrow:


http://cdsmith.wordpress.com/2011/08/13/arrow-category-applicative-part-iia/

However, even with the fixed Applicative instance, the Arrow instance does
not satisfy all laws. ListTransformer seems to be a type that has valid
Category and Applicative instances which do not give rise to a valid Arrow
instance as outlined by Chris. One of his additional axioms relating
Category and Applicative does not hold.

I have extended the (corrected) code with QuickCheck tests:

    https://gist.github.com/1521467

I wonder if now this datatype of yours is isomorphic to StreamSummary b r
> -> StreamSummary a r.
>

Not sure what you mean here. StreamSummary seems to be the same as
ListConsumer but I don't see how functions from consumers to consumers are
list transformers, i.e., functions from lists to lists.

Sebastian
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to