Skip to main content
Module

x/fun/option.ts>getInitializableOption

A collection of algebraic data types, lenses, and schemables based on a light weight higher kinded type implementation. Written for deno.
Latest
function getInitializableOption
import { getInitializableOption } from "https://deno.land/x/fun@v2.0.0/option.ts";

Create an instance of Initializable<Option> given an instance of Initializable.

Examples

Example 1

import * as O from "./option.ts";
import * as N from "./number.ts";
import { pipe } from "./fn.ts";

const { combine } = O.getInitializableOption(N.InitializableNumberSum);

const result1 = pipe(O.some(1), combine(O.some(1))); // Some(2)
const result2 = pipe(O.none, combine(O.some(1))); // Some(1)
const result3 = pipe(O.some(1), combine(O.none)); // Some(1)