<div dir="ltr">For folding containers of size >=1 with a semigroup I usually turn to classes from the semigroupoids package:<div><br></div><div><a href="http://hackage.haskell.org/package/semigroupoids-4.3/docs/Data-Semigroup-Foldable.html">http://hackage.haskell.org/package/semigroupoids-4.3/docs/Data-Semigroup-Foldable.html</a><br></div><div><a href="http://hackage.haskell.org/package/semigroupoids-4.3/docs/Data-Semigroup-Traversable.html">http://hackage.haskell.org/package/semigroupoids-4.3/docs/Data-Semigroup-Traversable.html</a><br></div><div><br></div><div>They are placed there, rather than in something like semigroups, because the 'return-less' variants of Monad and Applicative they need to provide most operations are placed in that package.</div><div><br></div><div>-Edward</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 12, 2015 at 3:05 PM, Henning Thielemann <span dir="ltr"><<a href="mailto:lemming@henning-thielemann.de" target="_blank">lemming@henning-thielemann.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
On Tue, 5 May 2015, Greg Weber wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The issue you have not raised that I am more concerned with is that NonEmpty only works for lists.<br>
Michael and I figured out how to extend the concept to any (Mono)Foldable structure and also to be able to<br>
demand lengths of > 1.<br>
</blockquote>
<br></span>
It's possible with the structure provided by "non-empty". It is also possible to construct types for lists of fixed length or lists with an arbitrary set of allowed lengths.<div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org" target="_blank">Libraries@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
</div></div></blockquote></div><br></div>