Point-free Programming via HKTs

Implementing point-free (tacit) programming patterns in TypeScript using Higher Kinded Types to overcome traditional type system limitations. Point-free style eliminates explicit arguments, composing functions like pipe(map(inc), filter(isEven), reduce(add)) instead of x => x.map(inc).filter(isEven).reduce(add). Through HKT encodings, we achieve true tacit programming where type inference flows through the entire pipeline, enabling cleaner functional abstractions without sacrificing TypeScript’s type safety.

Variadic HKT Composition

Extending Higher Kinded Types with variadic composition patterns, enabling clean functional composition while preserving complete type information. Building on HKT foundations, this explores variadic compositions where Compose<[F, G, H, ...]> handles arbitrary function chains with full type inference. Using advanced tuple manipulation and distributive conditional types, we achieve compositions like pipe(map, flatten, filter, reduce) that maintain type safety across any number of transformations - a significant advancement in TypeScript’s functional programming capabilities.

Higher Kinded Types in Typescript

A comprehensive introduction to Higher Kinded Types in TypeScript, exploring how to encode and utilize these powerful abstractions from functional programming. HKTs enable type constructors that take other type constructors as arguments - imagine Functor<F> that works for any F<T> whether it’s Array<T>, Promise<T>, or Option<T>. Through encoding techniques using interface augmentation and symbol keys, we can simulate HKTs in TypeScript, making possible advanced functional patterns like monadic composition and type-safe algebraic structures previously impossible in the language.

Type Guard Composition

Building composable type guard systems in TypeScript where runtime validation seamlessly integrates with compile-time type narrowing. Type guards like isString(x): x is string enable safe runtime checks, but composing them requires careful design. This explores combinators for union guards or(isNumber, isString): x is number | string, intersection guards and(hasName, hasAge): x is Person, and variadic patterns that preserve type inference. The result: elegant runtime validation that TypeScript’s control flow fully understands.

Programs of Length N: Collatz, Chaitin, and Church

How many lambda calculus programs exist with exactly $N$ terms? This exploration dives into deep questions about computational complexity, from counting programs like (λx. x x) (λx. x x) to analyzing the non-computable BB(N) busy beaver function that grows faster than any computable sequence. We examine Chaitin’s constant $Ω$ and why determining program convergence connects to unsolved problems like the Collatz conjecture collatz(3n + 1).

Unchained Tuple Types

Using TypeScript’s asserts syntax to create imperative-style type mutations, moving beyond method chaining to more familiar iterative patterns for complex type operations.

Chained Tuple Types

TypeScript 4.1’s variadic tuple types enable building complex type-safe data structures through method chaining, where each operation expands the chain’s type signature at compile time.

Self Modifying Type Predicates in Typescript

TypeScript’s type predicates can modify the type of this itself, enabling self-modifying type behavior that approaches dependent types. By implementing is<K extends keyof ShapeTypes>(type: K): this is ShapeTypes[K] on abstract classes, we achieve compile-time type narrowing where shape.is('circle') transforms the shape variable’s type from Shape to Circle, unlocking properties like shape.radius within conditional blocks.