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
@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}
@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 / 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 / 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
//
// 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 / 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
@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

μ΅œν›„μ˜ μ’…κ΅μ „μŸ: ν΄λ‘œμ €μ™€ ν•˜μŠ€μΌˆμ˜ λŒ€κ²°
μ„œλ¬Έ
세상은 두 μ§„μ˜μœΌλ‘œ λ‚˜λˆ„μ–΄μ‘Œλ‹€. ν•˜λ‚˜λŠ” 순수 ν•¨μˆ˜μ˜ μ •μˆ˜λ₯Ό 믿으며, λͺ¨λ“  λΆ€μž‘μš©μ„ λ©€λ¦¬ν•˜λŠ” ν•˜μŠ€μΌˆμ˜ μΆ”μ’…μžλ“€μ΄μ—ˆλ‹€.
λ‹€λ₯Έ ν•˜λ‚˜λŠ” Lisp의 μœ μ—°ν•œ μ² ν•™κ³Ό 맀크둜의 κ°•λ ₯함을 무기둜 μ‚ΌλŠ” ν΄λ‘œμ €μ˜ μ‹ λ„λ“€μ΄μ—ˆλ‹€.
μ΄μ•ΌκΈ°λŠ” λ¨Ό 미래, μ‹ μ„± μ½”λ“œμ˜ μ˜μ—­μ—μ„œ 두 μ§„μ˜μ˜ μ΅œν›„μ˜ μ’…κ΅μ „μŸμ΄ μ‹œμž‘λ¨μœΌλ‘œμ¨ νŽΌμ³μ§„λ‹€.
μž₯: 1 - λΆˆκ½ƒ νŠ€λŠ” μ‹œμž‘
μ½”λ“œμ˜ μ„±μ—­μ—μ„œ νŽΌμ³μ§„ νšŒμ˜λŠ” κΈ΄μž₯으둜 가득 μ°Όλ‹€. ν•˜μŠ€μΌˆ λŒ€μ‚¬μ œμΈ νœ΄μ΄λ“œλŠ” μžμ‹ μ˜ κΉ¨λ—ν•˜κ³  μš°μ•„ν•œ νƒ€μž… μ‹œμŠ€ν…œμ„ 높이 μΉ˜μΌœλ“€μ—ˆλ‹€.
import type { NextPage } from "next";
const Component3: NextPage = () => {
return (
<div className="w-[787px] max-w-full flex flex-col items-start justify-start pt-9 px-10 pb-10 box-border relative gap-[77px] tracking-[normal] text-left text-3xl text-default-black font-apple-sd-gothic-neo mq450:gap-[38px_77px]">
<section className="w-full h-full absolute !m-[0] top-[0px] right-[0px] bottom-[0px] left-[0px] rounded-lg bg-white" />
<section className="w-full h-[119px] absolute !m-[0] right-[0px] bottom-[11px] left-[0px] bg-white z-[2]" />
<div className="w-[333px] flex flex-col items-start justify-start gap-[36px] max-w-full mq450:gap-[18px_36px]">
<h3 className="m-0 relative text-inherit leading-[26.5px] font-bold font-inherit z-[1] mq450:text-lg">
μΉ΄ν…Œκ³ λ¦¬ μΆ”κ°€/μˆ˜μ •
import type { NextPage } from "next";
import FrameComponent36 from "../components/frame-component36";
import FrameComponent35 from "../components/frame-component35";
const Frame: NextPage = () => {
return (
<div className="w-full h-[1222px] relative bg-white overflow-hidden tracking-[normal] text-left text-sm text-default-black font-body1 mq450:h-auto mq450:min-h-[1222]">
<img
className="absolute top-[132px] left-[402.5px] w-[1517.5px] h-[1.5px]"
loading="lazy"