Skip to content

Instantly share code, notes, and snippets.

View kitlangton's full-sized avatar
🤠

Kit Langton kitlangton

🤠
View GitHub Profile
import zio._
import java.io.IOException
import java.time.LocalDateTime
//
// Meetup.com
//
// Notifications
// notify every user who is subbed to an upcoming event
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
@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.*
@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
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