|> or ▹
- Pipe
- The Thrush combinator
| scalaz (series/7.2.x)$ grep -R 'def [^A-Za-z_]' core effect concurrent iteratee | |
| core/src/main/scala/scalaz/Arrow.scala: final def <<<[A, B, C](fbc: (B =>: C), fab: (A =>: B)): =>:[A, C] = | |
| core/src/main/scala/scalaz/Arrow.scala: def >>>[A, B, C](fab: (A =>: B), fbc: (B =>: C)): (A =>: C) = | |
| core/src/main/scala/scalaz/BijectionT.scala: def ***[C, D](g: Bijection[C, D])(implicit evF: F[B] =:= Id[B], evG: G[A] =:= Id[A]): Bijection[(A, C), (B, D)] = | |
| core/src/main/scala/scalaz/BijectionT.scala: def ^^^[C, D](g: Bijection[C, D])(implicit evF: F[B] =:= Id[B], evG: G[A] =:= Id[A]): Bijection[A \/ C, B \/ D] = | |
| core/src/main/scala/scalaz/BijectionT.scala: def <=<[C](that: BijectionT[F, G, C, A])(implicit FM: Bind[F], GM: Bind[G]): BijectionT[F, G, C, B] = compose(that) | |
| core/src/main/scala/scalaz/BijectionT.scala: def >=>[C](that: BijectionT[F, G, B, C])(implicit M: Bind[F], GM: Bind[G]): BijectionT[F, G, A, C] = andThen(that) | |
| core/src/main/scala/scalaz/Cofree.scala: final def =>>[B](f: Cofree[S, A] => B)(implicit |
| implicit val pc = PopulationControl( | |
| dataSource=postgressDs, | |
| ...customzation here) | |
| "Friends database" should { | |
| populate(""" | |
| # User |
| scala> :paste | |
| // Entering paste mode (ctrl-D to finish) | |
| object Colours extends Enumeration { | |
| val Red, Amber, Green = Value | |
| } | |
| object WeekDays extends Enumeration { | |
| val Mon,Tue,Wed,Thu,Fri = Value | |
| } |
| scala> :paste | |
| // Entering paste mode (ctrl-D to finish) | |
| def traffic(colour: Colours.Value) = colour match { | |
| case Colours.Green => "Go" | |
| } | |
| // Exiting paste mode, now interpreting. | |
| traffic: (colour: Colours.Value)String |
| object WeekDay { | |
| sealed trait EnumVal | |
| case object Mon extends EnumVal | |
| case object Tue extends EnumVal | |
| case object Wed extends EnumVal | |
| case object Thu extends EnumVal | |
| case object Fri extends EnumVal | |
| val daysOfWeek = Seq(Mon, Tue, Wed, Thu, Fri) | |
| } |
| object SolarSystemPlanets { | |
| sealed abstract class Planet( | |
| val orderFromSun : Int, | |
| val name : String, | |
| val mass : Kilogram, | |
| val radius : Meter) extends Ordered[Planet] { | |
| def compare(that: Planet) = this.orderFromSun - that.orderFromSun |
| scala> import SolarSystemPlanets._ | |
| import SolarSystemPlanets._ | |
| scala> println(planets) | |
| TreeSet(Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus, Neptune) | |
| scala> EARTH < MARS | |
| res1: Boolean = true | |
| scala> planets.filter(_.radius > 7.0e6) |
| package code.filter | |
| import javax.servlet._ | |
| import http._ | |
| import java.util.regex._ | |
| // A wrapper around an HTTP Servlet Request which removes any /cached/:id from a URI | |
| case class ResouceRequest(req: HttpServletRequest) extends HttpServletRequestWrapper(req) { | |
| // The URI without the /cached/:id part: |
| import play.api.libs.json._ | |
| case class Notify(email: Option[String] = None) | |
| implicit val reader = Json.reads[Notify] | |
| Json.parse(""" { "email": "[email protected]" } """).asOpt[Notify] | |
| // res0: Option[Notify] = Some(Notify(Some([email protected]))) | |
| Json.parse(""" { } """).asOpt[Notify] | |
| // res1: Option[Notify] = Some(Notify(None)) |