<div dir="ltr"><div><div><div><div>I think what you're looking for are monoid actions: <a href="http://hackage.haskell.org/package/monoid-extras-0.2.2.0/docs/Data-Monoid-Action.html">http://hackage.haskell.org/package/monoid-extras-0.2.2.0/docs/Data-Monoid-Action.html</a><br>
</div>And the laws the typeclass should satisfy:<br></div>foo bar = id<br></div>foo f . foo g = foo (f `mappend` g)<br><br></div>The identity law is optional, in whihc case your 'e' would be a semigroup without a default 'bar'<br>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On 21 April 2014 11:46, Tobias Brandt <span dir="ltr"><<a href="mailto:tob.brandt@googlemail.com" target="_blank">tob.brandt@googlemail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><span style="font-family:monospace">Your class looks like Unfoldable from </span><a href="http://hackage.haskell.org/package/collections-api-1.0.0.0/docs/Data-Collections.html" style="font-family:monospace" target="_blank">Data.Collections</a><span style="font-family:monospace">. foo is insert and bar is empty. The other three methods can be defined in terms of insert and empty.</span><br>

</div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On 21 April 2014 07:09, Bardur Arantsson <span dir="ltr"><<a href="mailto:spam@scientician.net" target="_blank">spam@scientician.net</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br>
<br>
I was wondering if anyone out there knows if this type class has a name?<br>
<br>
  class Foo a e where<br>
     foo :: e -> a -> a<br>
     bar :: a<br>
<br>
(I also have a fundep a -> e, but that's not essential.)<br>
<br>
Essentially the usage is:<br>
<br>
   You have a sequence of "events" e_i and a starting value<br>
   "bar" and can use the "foo" function to apply all events<br>
   to that starting value<br>
<br>
      foo e_n $ foo e_{n-1} $ ... $ foo e_0 $ bar<br>
<br>
   and thus get the final value of the a induced by the<br>
   events e_i.<br>
<br>
(I've included the "bar" starting value in the type class, but I suppose<br>
it could be supplied by a Default instance.)<br>
<br>
Regards,<br>
<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div><br></div>