Skip to main content
Module

x/fun/mod.ts>option.tryCatch

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

tryCatch takes a thunk that can potentially throw and wraps it in a try/catch statement. If the thunk throws then tryCatch returns None, otherwise it returns the result of the thunk wrapped in a Some.

TODO: implement like taskEither tryCatch

Parameters

fa: () => A