Skip to content

Instantly share code, notes, and snippets.


Ionuț G. Stan igstan

View GitHub Profile
View visitors-1.scala
trait SACVisitor[R] {
def c1(a: Int): R
def c2(a: R, b: R): R
sealed trait SAC extends Product with Serializable {
def fold[R](visitor: SACVisitor[R]): R
object SAC {
View StateComposition.scala
import cats.implicits._
import cats.Monad
// Two capability/tagless final traits: Foo & Bar
trait Foo[F[_]] {
def foo: F[Unit]
View execution.log
$ ./to-csv.sed records.xml
View BubbleUpObservable.scala
import cats.Eq
import monix.reactive.Observable
object Main {
implicit final class ObservableOps[A](private val self: Observable[A]) extends AnyVal {
def bubbleUpHot(a: A)(implicit Eq: Eq[A]): Observable[A] =
self.publishSelector { hot =>
val special = hot.find(_ === a)
val beforeSpecial = hot.takeWhile(_ =!= a)
View OptionalVisitor.scala
trait Optional[A] {
def visit[R](visitor: Optional.Visitor[A, R]): R
// Alias to show that visiting is similar to pattern matching.
def matching[R](visitor: Optional.Visitor[A, R]): R =
object Optional {
View ServicePrincipal.ts
import * as azure from "@pulumi/azure";
import * as azuread from "@pulumi/azuread";
import * as pulumi from "@pulumi/pulumi";
import * as random from "@pulumi/random";
export const app = new azuread.Application('pulumi', {
availableToOtherTenants: false,
homepage: "",
identifierUris: [""],
oauth2AllowImplicitFlow: true,

Bucharest FP #61 — Implementing IMP in K and Haskell

Event Agenda

  • 18:45 — 19:00 Welcome
  • 19:00 — 20:00 Everett Hildenbrandt — Side-by-side implementation of an IMP language in K and Haskell
  • 20:00 — 21:00 Networking

Talk Abstract

View QuotedString.scala
final class QuotedString(private val sc: StringContext) extends AnyVal {
* {{{
* scala> val msg = "foo"
* msg: String = foo
* scala> qs"$msg"
* res1: String = "foo"
* scala> qs"<$msg"
igstan / RecordingApplicative.hs
Last active Aug 22, 2021
An Applicative that records the instructions of underlying computations.
View RecordingApplicative.hs
{-# LANGUAGE DeriveFunctor #-}
import Control.Applicative
import Control.Monad.Writer
import Control.Monad.Reader
import Control.Monad.Identity
import Data.Map (Map, (!))
import qualified Data.Map as Map
import Data.List (groupBy, intercalate, nub)
import Data.Function (on)
View gist:104442ea863fb90321475edb1eac251a
import java.util.Date
import java.util.concurrent.TimeUnit
import cats._
import cats.effect.{ExitCode, IO, IOApp}
import cats.implicits._
import cats.mtl.MonadState