This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(field[User]("user")(json) <*> | |
(field[Boolean]("truncated")(json) <*> | |
(field[String]("text")(json) <*> | |
(field[String]("source")(json) <*> | |
(field[Boolean]("retweeted")(json) <*> | |
(field[Int]("retweet_count")(json) <*> | |
(field[Option[Place]]("place")(json) <*> | |
(field[Option[Id]]("in_reply_to_user_id")(json) <*> | |
(field[Option[Id]]("in_reply_to_status_id")(json) <*> | |
(field[Option[String]]("in_reply_to_screen_name")(json) <*> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scalaz._ | |
import Scalaz._ | |
import IterV._ | |
object DropWhile { | |
implicit val IteratorEnumerator = new Enumerator[Iterator] { | |
def apply[E, A](e: Iterator[E], i: IterV[E, A]): IterV[E, A] = e match { | |
case iter if iter.hasNext => i.fold(done = (_, _) => i, cont = k => apply(iter, k(El(iter.next)))) | |
case iter => i |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class ScalaChan() | |
implicit def ScalaChanEqual: Equal[ScalaChan] = new Equal[ScalaChan] { | |
def equal(a1: ScalaChan, a2: ScalaChan): Boolean = a1 == a2 | |
} | |
implicit def ScalaChanEqual: Equal[ScalaChan] = equal(_ == _) | |
implicit def ScalaChanEqual: Equal[ScalaChan] = equalA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def check[A: Equal: Show: Monoid](a: A) = { | |
a |+| mzero[A] assert_=== a | |
mzero[A] |+| a assert_=== a | |
} | |
check(1) | |
check("Scalaz") | |
check(List(1, 2, 3)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scala> (nil[Int]: MA[List, Int]) | |
res65: scalaz.MA[List,Int] = scalaz.MAs$$anon$3@1d45221 | |
scala> (none[String]: MA[Option, String]) | |
res66: scalaz.MA[Option,String] = scalaz.MAsLow$$anon$1@90cae4 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class ScalaChan[A](value: A) | |
implicit def ScalaChanEqual[A]: Equal[ScalaChan[A]] = equalA | |
implicit def ScalaChanShow[A]: Show[ScalaChan[A]] = showA | |
implicit lazy val ScalaChanFunctor: Functor[ScalaChan] = new Functor[ScalaChan] { | |
def fmap[A, B](a: ScalaChan[A], f: A => B): ScalaChan[B] = ScalaChan(f(a.value)) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class ScalaChan[A](value: A) | |
implicit def ScalaChanEqual[A]: Equal[ScalaChan[A]] = equalA | |
implicit def ScalaChanShow[A]: Show[ScalaChan[A]] = showA | |
implicit lazy val ScalaChanFunctor: Functor[ScalaChan] = new Functor[ScalaChan] { | |
def fmap[A, B](a: ScalaChan[A], f: A => B): ScalaChan[B] = ScalaChan(f(a.value)) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1.wrapNel assert_=== NonEmptyList(1) | |
nel(1, 2, 3) assert_=== NonEmptyList(1, 2, 3) | |
1 <:: 1.wrapNel assert_=== NonEmptyList(1, 1) | |
1.wrapNel :::> List(2, 3) assert_=== NonEmptyList(1, 2, 3) | |
List(1, 2) <::: 3.wrapNel assert_=== NonEmptyList(1, 2, 3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lazy val f: Int => Int => Int = i => j => (i ∏) |+| (j ∏) | |
val a = for { | |
i <- 2.some | |
j <- 100.some | |
} yield f(i)(j) | |
val x = for { | |
i <- nel(1, 2, 3) | |
j <- nel(4, 5, 6) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class ScalaChan[A](value: A) | |
implicit def ScalaChanEqual[A]: Equal[ScalaChan[A]] = equalA | |
implicit def ScalaChanShow[A]: Show[ScalaChan[A]] = showA | |
implicit lazy val ScalaChanPure: Pure[ScalaChan] = new Pure[ScalaChan] { | |
def pure[A](a: => A): ScalaChan[A] = ScalaChan(a) | |
} |