Skip to main content
Module

x/fun/mod.ts>option.getInitializable

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.getInitializable
import { option } from "https://deno.land/x/fun@v2.0.0-alpha.12/mod.ts";
const { getInitializable } = option;

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.getInitializable(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)

Parameters

unnamed 0: Initializable<A>

Returns

Initializable<Option<A>>