createBindTo
import { createBindTo } from "https://github.gh-proxy.cn/raw.githubusercontent.com/baetheus/fun/main/mappable.ts";Create a bindTo function from a structure with an instance of Mappable. A
bindTo function takes the inner value of the structure and maps it to the
value of a struct with the given name. It is useful for lifting the value
such that it can then be used with a bind function, effectively allowing
for Do-like notation in typescript.
@example
import { createBindTo } from "./mappable.ts";
import * as O from "./option.ts";
import { pipe } from "./fn.ts";
const bindTo = createBindTo(O.MappableOption);
const option = O.some(5);
const result = pipe(
option,
bindTo("value")
);
console.log(result); // Some({ value: 5 })