Hello, fn42
Welcome to fn42.dev — my little corner of the internet. The name is a tiny
manifesto: fn for functional, the paradigm I enjoy the most, and 42
because, according to The Hitchhiker's Guide to the Galaxy, it is the answer
to life, the universe, and everything.
This site is a hub: notes on programming, experiments, and ideas worth keeping.
Functions all the way down
I like code that reads like a description of what, not how. Pure functions compose, and composition scales:
type Fn<A, B> = (a: A) => B;
const compose =
<A, B, C>(g: Fn<B, C>, f: Fn<A, B>): Fn<A, C> =>
(a) =>
g(f(a));
const hello = (s: string) => "Hello " + s;
const world = (s: string) => s + "world!";
const greeting = compose(world, hello)(""); // "Hello world!"Don't panic. And always know where your towel is.