4 ms·
Got `maybeOut` wrong, can't edit, but it should be: maybeOut :: (a -> b) -> (a -> Maybe b) maybeOut = (.) Just Also the parenthesis around the last two
by itishappy 2y ago
Got `maybeOut` wrong, can't edit, but it should be:
maybeOut :: (a -> b) -> (a -> Maybe b)
maybeOut = (.) Just
Also the parenthesis around the last two output types are added for emphasis, but can be safely removed.
- itishappy 2y agoLast 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