Skip to content

Instantly share code, notes, and snippets.

View eoncarlyle's full-sized avatar
🌴
On vacation

Iain Schmitt eoncarlyle

🌴
On vacation
View GitHub Profile
@eoncarlyle
eoncarlyle / incorrectMonadExplanation.ts
Created December 26, 2024 19:53
Incorrect Monad Explanation
import { pipe } from "fp-ts/function";
import { IO, chain as chainIO, map as mapIO } from "fp-ts/IO";
const effect: IO<string> = () => "myString";
// Functors implement map, and these are useful
const singleChange: (fa: IO<string>) => IO<string> = mapIO((input: string) =>
input.toUpperCase(),
);
const singleChangeApplied = singleChange(effect);