Skip to content

Instantly share code, notes, and snippets.

sealed trait TaskComapped[L <: HList, M <: HList]
object TaskComapped{
implicit def nil: TaskComapped[HNil, HNil] = new TaskComapped[HNil, HNil]{}
implicit def cons[Head, Tail <: HList, ResultsTail <: HList](implicit tc: TaskComapped[Tail, ResultsTail]) =
new TaskComapped[Task[Head] :: Tail, Head :: ResultsTail]{}
}
abstract class Task[R](value: R) {
def destination: Int
}
@Lasering
Lasering / ws.scala
Last active May 29, 2017 23:16
Http4s Websocket handleWithActor
package org.http4s.akka
import scalaz.concurrent.Task
import scalaz.stream.async.mutable.Queue
import scalaz.stream.{Exchange, Process, Sink, async}
import akka.actor.{Actor, ActorSystem, OneForOneStrategy, PoisonPill, Props, SupervisorStrategy, Terminated}
import org.http4s.server.websocket.{WS => Http4sWS}
import org.http4s.websocket.WebsocketBits.{Close, Text, WebSocketFrame}
import org.http4s.{Response, Status}