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 unfiltered.response._ | |
import unfiltered.request._ | |
import unfiltered.filter._ | |
import unfiltered.directives._ | |
import Directive._ | |
import scala.concurrent.Future | |
import scala.util.Try | |
import javax.servlet.http.{HttpServletResponse, HttpServletRequest} | |
object AsyncDirective { |
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
package argonaut.example | |
import argonaut._, Argonaut._ | |
import scalaz._, Scalaz._ | |
object UnionExample extends { | |
sealed trait Thing | |
final case class One(n: String, i: Int) extends Thing | |
final case class Two(n: String) extends Thing |
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 lastB[F[_]: Async, A, B]: Pipe2[F, A, B, (A, B)] = { | |
def go( | |
lastB: B, | |
l: ScopedFuture[F, Pull[F, Nothing, (Option[A], Handle[F,A])]], | |
r: ScopedFuture[F, Pull[F, Nothing, (Option[B], Handle[F,B])]] | |
): Pull[F,(A, B),Nothing] = | |
(l race r).pull flatMap { | |
case Left(l) => l.optional flatMap { | |
case None => Pull.done | |
case Some((None, l)) => Pull.done |