Skip to content

Instantly share code, notes, and snippets.

jdegoes / Zippable.scala
Created Mar 17, 2021
Compositional zipping
View Zippable.scala
package spartans.zipped
object Zipped {
sealed trait Zippable[-A, -B] {
type Out
def zip(left: A, right: B): Out
object Zippable extends ZippableLowPriority {
type Out[-A, -B, C] = Zippable[A, B] { type Out = C }
View Cron.scala
package zio.cron
import java.time.{ Month => JMonth }
import java.time.{ DayOfWeek => JDayOfWeek }
import zio.Schedule
// 0 16 1,15 * * echo Timesheets Due > /dev/console
final case class CronSchedule(
minute: CronSchedule.Minute,
View CCC.scala
package zio.prelude
trait FunctionBoth[:=>[-_, +_]] extends IdentityCompose[:=>] {
def both[A, B, C, D](f: A :=> B, g: C :=> D): (A, C) :=> (B, D)
def toRightBoth[A]: (Unit, A) :=> A
def toLeftBoth[A]: (A, Unit) :=> A
def lassocBoth[A, B, C]: (A, (B, C)) :=> ((A, B), C)
def rassocBoth[A, B, C]: ((A, B), C) :=> (A, (B, C))
View connect.scala
package zio.connect
import zio._
trait S3Connector {
// Powered by ZIO S3
type S3Connector
type S3Credentials
type S3Exception
View Cron.scala
package zio.cron
import java.time.Instant
final case class Cron(moh: Option[MinuteOfHour], hod: Option[HourOfDay], dom: Option[DayOfMonth], moy: Option[MonthOfYear], dow: Option[DayOfWeek]) {
* Returns a `Cron` that describes execution only when both this `Cron` and
* the specified `Cron` would run.
View DynamoDB.scala
package zio.dynamodb
import zio.{ Chunk, Task, ZLayer }
import zio.blocking.Blocking
jdegoes / http4k.ks
Created Apr 23, 2020
Adding multipart responses into http4k
View http4k.ks
// RFC:
interface Response {
fun multipartBoundary(boundary: String): Response
fun multiparts(): List<Response>
// The returned Response will use a content type of multipart response with
// a boundary string determined by the implementation.
jdegoes / ZMX.scala
Created Apr 10, 2020
ZMX Design Sketch
View ZMX.scala
package zio
import zio.duration.Duration
package object zmx extends MetricsDataModel with MetricsConfigDataModel {
type Diagnostics = Has[Diagnostics.Service]
object Diagnostics {
trait Service {
jdegoes /
Created Mar 4, 2020
Migration notes for ZIO-1.0.0-RC18

ZIO's last release candidate before 1.0 (RC18) has arrived!

The first question every user needs to ask themselves:

  • Should they upgrade now?
  • Should they wait for ZIO 1.0?

We need some adventurous souls to upgrade now, because the feedback so generated will help convince us we're ready to pull the trigger on ZIO 1.0 in a couple weeks time.

On the other hand, upgrading now is going to be more difficult, because not all ZIO libraries have been updated to RC18 (we are early in that process), and there is very poor documentation.

jdegoes /
Last active Dec 29, 2019
Possible ZIO Workshops
  • Scheduling & Retrying with ZIO: A 2 hour workshop that shows how to create and use schedules and retry policies with ZIO. Scheduling covers cache use cases, downloading resources, sending emails; retrying covers flaky web APIs, database connections, etc.
  • ZIO CRUD. A 2 hour workshop showing how to build a basic REST API using ZIO + third-party library.
  • Using ZIO with Legacy Code: A 2 hour workshop that shows how to wrap lots of legacy code: sync code, async code, Future code; and demonstrate use of Runtime to unsafeRun at boundary points for roundtrip integration.
  • Crash Course in ZIO: A 2 hour workshop that covers “hello world” and a few other simple examples of writing programs with ZIO, with an emphasis on thinking functionality (values & operators on values) and using ‘for’ comprehensions successfully.
  • Rethinking Error Management: A 2 hour workshop that shows how to effectively use recoverable and non-recoverable errors, as well as lossless errors, to build resilient apps that