Note that there are some explanatory texts on larger screens.

plurals
  1. PORound-up of Scalaz type class instances for other libraries
    primarykey
    data
    text
    <p>I often find myself wanting (and then usually writing) <a href="http://code.google.com/p/scalaz/" rel="nofollow noreferrer">Scalaz</a> type class instances for classes in other Scala or Java libraries. To give just a few examples:</p> <p>A monoid instance for <a href="https://github.com/milessabin/shapeless" rel="nofollow noreferrer">Shapeless</a>'s <code>HList</code> gives you <a href="https://stackoverflow.com/a/11439044/334519">monoid instances for case classes with appropriately typed members</a> almost for free.</p> <p>An applicative functor instance for <a href="http://liftweb.net/" rel="nofollow noreferrer">Lift</a>'s <code>Box</code> allows you for example to sequence a list of boxes:</p> <pre><code>scala&gt; val boxen: List[Box[Int]] = Full(1) :: Full(2) :: Full(3) :: Nil boxen: List[net.liftweb.common.Box[Int]] = List(Full(1), Full(2), Full(3)) scala&gt; boxen.sequence res0: net.liftweb.common.Box[List[Int]] = Full(List(1, 2, 3)) </code></pre> <p>A monad instance for <a href="http://dispatch.databinder.net/Dispatch.html" rel="nofollow noreferrer">Dispatch 0.9</a>'s <code>Promise</code> (and <code>Promise[Either[Throwable, _]]</code>, etc.) is hugely useful for all kinds of things.</p> <p>An <a href="https://stackoverflow.com/q/7785762/334519">applicative functor instance</a> for the standard library's <code>Parser</code> makes applicative parsing more concise and elegant. (I just noticed that Scalaz 7 <a href="https://github.com/scalaz/scalaz/blob/scalaz-seven/core/src/main/scala/scalaz/std/util/parsing/combinator/Parser.scala" rel="nofollow noreferrer">now provides a monad instance for <code>Parser</code></a>.)</p> <p>And so on...</p> <p>These instances are almost always very general-purpose, and I'm sure lots of us have written lots of these lots of times. What I'm fishing for with this question is some kind of aggregator or clearinghouse for Scalaz type class instances. I'm not sure such a thing exists—I certainly haven't been able to find anything like it—but even just a collection of links to blog posts, GitHub repositories, or other resources would be useful to me.</p> <p>I'd prefer Scalaz 7 instances, but I'll take anything I can get.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload