Skip to content

Instantly share code, notes, and snippets.

View coleea's full-sized avatar
💭
I may be slow to respond.

Mario KB coleea

💭
I may be slow to respond.
View GitHub Profile
최후의 종교전쟁: 클로저와 하스켈의 대결
서문
세상은 두 진영으로 나누어졌다. 하나는 순수 함수의 정수를 믿으며, 모든 부작용을 멀리하는 하스켈의 추종자들이었다.
다른 하나는 Lisp의 유연한 철학과 매크로의 강력함을 무기로 삼는 클로저의 신도들이었다.
이야기는 먼 미래, 신성 코드의 영역에서 두 진영의 최후의 종교전쟁이 시작됨으로써 펼쳐진다.
장: 1 - 불꽃 튀는 시작
코드의 성역에서 펼쳐진 회의는 긴장으로 가득 찼다. 하스켈 대사제인 휴이드는 자신의 깨끗하고 우아한 타입 시스템을 높이 치켜들었다.
@coleea
coleea / ability-tutorial.output.md
Created March 21, 2024 12:30 — forked from atacratic/ability-tutorial.output.md
Unison abilities - unofficial alternative tutorial

This tutorial explains how Unison handles 'effectful' computations, like storing state or performing I/O, using abilities. It assumes you haven't come across abilities before, and covers everything from the ground up.

This is an unofficial tutorial, written before the one on unisonweb.org/docs. The approach taken here is slow and methodical. Your first stop should be the official tutorial, if you haven't seen it already.

This doc is a Unison transcript - the source is here.

Terminology note: other languages with ability systems typically call them 'effect handlers' or 'algebraic effects', but many of the ideas are the same.

Introducing abilities

@coleea
coleea / kyo.scala
Created March 14, 2024 01:00 — forked from kitlangton/kyo.scala
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
// Adapted from http://lukajcb.github.io/blog/functional/2018/01/03/optimizing-tagless-final.html
import { Applicative, Applicative1 } from 'fp-ts/lib/Applicative'
import { Apply, Apply1, Apply2C, applySecond, liftA4 } from 'fp-ts/lib/Apply'
import * as array from 'fp-ts/lib/Array'
import * as const_ from 'fp-ts/lib/Const'
import { HKT, Type, Type2, URIS, URIS2 } from 'fp-ts/lib/HKT'
import { IO, io, URI as IOURI } from 'fp-ts/lib/IO'
import { Option, some } from 'fp-ts/lib/Option'
import { getProductSemigroup, Semigroup } from 'fp-ts/lib/Semigroup'
@coleea
coleea / fp-ts-to-the-max-I.ts
Created January 16, 2024 12:59 — forked from gcanti/fp-ts-to-the-max-I.ts
TypeScript port of the first half of John De Goes "FP to the max" (https://www.youtube.com/watch?v=sxudIMiOo68)
import { log } from 'fp-ts/lib/Console'
import { none, Option, some } from 'fp-ts/lib/Option'
import { randomInt } from 'fp-ts/lib/Random'
import { fromIO, Task, task } from 'fp-ts/lib/Task'
import { createInterface } from 'readline'
//
// helpers
//
@coleea
coleea / fp-ts-to-the-max-II.ts
Created January 16, 2024 12:58 — forked from gcanti/fp-ts-to-the-max-II.ts
TypeScript port of the second half of John De Goes "FP to the max" (https://www.youtube.com/watch?v=sxudIMiOo68)
import { log } from 'fp-ts/lib/Console'
import { Type, URIS } from 'fp-ts/lib/HKT'
import { none, Option, some } from 'fp-ts/lib/Option'
import { randomInt } from 'fp-ts/lib/Random'
import { fromIO, Task, task, URI as TaskURI } from 'fp-ts/lib/Task'
import { createInterface } from 'readline'
//
// helpers
//
@coleea
coleea / tsconfig.json
Last active January 10, 2024 14:45
tsconfig.json : the extremely strict version
{
"compilerOptions": {
// Base Strict Checks
"suppressExcessPropertyErrors": false,
"suppressImplicitAnyIndexErrors": false,
"noStrictGenericChecks": false
// Strict Checks
"alwaysStrict": true,
@coleea
coleea / StateReaderTaskEitherExample.ts
Last active May 1, 2023 02:08
fp-ts : Example of StateReaderTaskEither
// originally written by evolu
// https://twitter.com/evoluhq/status/1530920057303449601/photo/1
import { flow } from 'fp-ts/lib/function'
import * as E from 'fp-ts/lib/Either'
import * as SRTE from 'fp-ts/lib/StateReaderTaskEither'
import {StateReaderTaskEither} from 'fp-ts/lib/StateReaderTaskEither'
type Config = {logs : string[]}
type Deps = {multiplier : number}