Skip to content

Instantly share code, notes, and snippets.

@gcanti
gcanti / optionT.js
Last active May 16, 2021 09:20
Monad transformer example (OptionT), Flow and fp-ts, npm install fp-ts
// @flow
import type { Option } from 'fp-ts/lib/Option'
import type { Lazy } from 'fp-ts/lib/function'
import type { Monad } from 'fp-ts/lib/Monad'
import * as optionT from 'fp-ts/lib/OptionT'
import { array } from 'fp-ts/lib/Array'
// If M<A> is a monad then M<Option<A>> is a monad
@gcanti
gcanti / fp-ts-technical-overview.md
Last active March 11, 2024 02:40
fp-ts technical overview

Technical overview

A basic Option type

// Option.ts

// definition
export class None {
  readonly tag: 'None' = 'None'

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?