Skip to content

Instantly share code, notes, and snippets.

View kryptt's full-sized avatar
:octocat:
Looking for inspiration

Rodolfo Hansen kryptt

:octocat:
Looking for inspiration
View GitHub Profile
@kryptt
kryptt / Main.hs
Created January 11, 2021 20:57
Untitled Project
{-# LANGUAGE OverloadedStrings #-}
module Example where
import Language.Marlowe
main :: IO ()
main = print . pretty $ contract
{- Define a contract, Close is the simplest contract which just ends the contract straight away
@kryptt
kryptt / Main.hs
Last active January 11, 2021 21:01
Needs a Name UC1
{-# LANGUAGE OverloadedStrings #-}
module Example where
import Language.Marlowe
main :: IO ()
main = print . pretty $ contract
{- Define a contract, Close is the simplest contract which just ends the contract straight away
@kryptt
kryptt / SseClient.scala
Created June 10, 2021 13:51 — forked from izeigerman/SseClient.scala
Complete SSE client Implementation for Scala using http4s.
import cats.effect.{IO, Timer}
import fs2.{Pull, Stream}
import org.http4s._
import org.http4s.ServerSentEvent.EventId
import org.http4s.client.Client
import org.http4s.headers.{`Cache-Control`, Accept}
import scala.concurrent.duration._
import SseClient._
final class SseClient private (
@kryptt
kryptt / optional.cpp
Last active September 13, 2021 15:54
fp-in-cpp
#include <tl/expected.hpp>
#include <iostream>
#include <stdexcept>
#include <functional>
#include <variant>
// Logic in modern civilization
template<typename A, typename B>
using And = std::tuple<A, B>;
@kryptt
kryptt / pipes.scala
Created September 28, 2021 10:04
Caching pipes
package kobo
package assist
import scalacache.{Cache, Mode}
import fs2.{INothing, Pipe, Stream}
import fs2.concurrent._
import cats.syntax.all._
import cats.data.{EitherT, OptionT}
@kryptt
kryptt / cats-eo.scala
Last active May 21, 2022 16:49
existential optics
package eo
import cats.{Applicative, Bifunctor, Functor, Traverse}
import cats.arrow._
import cats.implicits._
trait Accessor[F[_, _]] {
def get[A]: [X] => F[X, A] => A
}