Skip to main content
Module

x/fun/mod.ts>option.extend

A collection of algebraic data types, lenses, and schemables based on a light weight higher kinded type implementation. Written for deno.
Go to Latest
function option.extend
import { option } from "https://deno.land/x/fun@v.2.0.0-alpha.11/mod.ts";
const { extend } = option;

Extend an Option by mapping it to a concrete value.

Examples

Example 1

import * as O from "./option.ts";
import { identity } from "./fn.ts";

const match = O.match(() => 0, identity);
const extend = O.extend(match);

const result1 = extend(O.some(1)); // Some(1);
const result2 = extend(O.none); // Some(0);

Parameters

ftai: (ta: Option<A>) => I

Returns

(ta: Option<A>) => Option<I>