Skip to content

Instantly share code, notes, and snippets.

View kitlangton's full-sized avatar
🤠

Kit Langton kitlangton

🤠
View GitHub Profile
package tttt
// Awesome 😄 That looks great. It maintains all of the properties of the Frank (or, Langton style 😛) encoding—where one can recurse with different handlers and short-circuit trivially—without losing the tail-recursive stack safety. And I fully trust you when it comes to the JIT-ability of it all!
// The only issues are minor UX ones, in that it could be confusing for the user to know whether to call
import izumi.reflect.Tag
type Id[T] = T
type Const[T] = [U] =>> T
type MX[T] = Any
@kitlangton
kitlangton / kyo.scala
Last active March 19, 2024 23:55
Kyo (Alt. Encoding Explorations)
package zero
import izumi.reflect.Tag
import Kyo.*
import scala.collection.View.FlatMap
type Id[T] = T
type Const[T] = [U] =>> T
type MX[T] = Any
@kitlangton
kitlangton / zero.scala
Created March 10, 2024 13:55
zero.scala
import izumi.reflect.Tag
import <.Handler
opaque type <[+A, -S] = Zero[A, S]
inline implicit def toZero[A, S](v: A): A < S = Zero.Succeed(v)
inline implicit def fromZero[A, S](zero: Zero[A, S]): A < S = zero
object < :
import Zero.*
package book
object WithoutTypeParams:
sealed trait Expr
case class IntExpr(int: Int) extends Expr:
def add(other: IntExpr): IntExpr = IntExpr(int + other.int)
case class BoolExpr(bool: Boolean) extends Expr
case class IfThenElseExpr(cond: BoolExpr, thenExpr: Expr, elseExpr: Expr) extends Expr
import zio._
import java.io.IOException
import java.time.LocalDateTime
//
// Meetup.com
//
// Notifications
// notify every user who is subbed to an upcoming event
package zio.http.api.internal
sealed trait Box[A] extends Product with Serializable { self =>
def zip[B](that: Box[B])(implicit zipper: Zipper[A, B]): Box[zipper.Out] =
Box.Zip[A, B, zipper.Out](self, that, zipper)
def map[B](f: A => B)(implicit tupleSize: TupleSize[B]): Box[B] =
Box.Map(self, f, tupleSize)
def tupleSize: Int = self match {
import zio.{RuntimeFlags => _, _}
import scala.annotation.implicitNotFound
// # ANNOUNCEMENTS
// - NEXT WEEK (Friday, 16th) : Akka to ZIO Demo
// - NEXT, NEXT WEEK (Friday, 23rd): Akka to ZIO Panel
// # ZIO API Design Techniques
What a beautiful file.
That's great.
One more line will do.
package zio
object PathDependentTypes {
val zio1: ZIO[Any, Nothing, Int] = ZIO.succeed(1)
val zio2: ZIO[Any, Nothing, Int] = ZIO.succeed(2)
val zio3: ZIO[Any, Nothing, Int] = ZIO.succeed(3)
val zio4 = zio1 <*> zio2 <*> zio3 <*> zio1 <*> zio2
@kitlangton
kitlangton / zio-interop-laminar.scala
Last active July 14, 2022 13:44
Zio Laminar Interop
package zio.interop
import com.raquo.laminar.api.L._
import zio._
import zio.internal.{Executor, Platform}
import zio.stream.ZStream
import scala.concurrent.ExecutionContext
import scala.scalajs.js