News for hackers. Stuff that matters.
Re:Why Haskell? by itishappy on Thursday September 12, 2024 @08:36PM (#41527080)
Last reply. Probably. Here's `maybe` in TypeScript:

    const maybe = <T,>(f: (_: T) => T, d:T) => (x: T|null) => f(x || d);

    console.log(maybe((x) => 2 * x, 3)(null)); // returns: 6

There are no comments on this comment yet.