Link Search Menu Expand Document

Either overview

Utility functions to accommodate fp-ts/Either.

Added in v0.1.0


Table of contents


utils

unsafeUnwrap

Unwrap the value from within an Either, throwing the inner value of Left if Left.

Signature

export declare const unsafeUnwrap: <A>(x: Either<unknown, A>) => A
unsafeUnwrap :: Either unknown a -> a

Example

import { unsafeUnwrap } from 'fp-ts-std/Either'
import * as E from 'fp-ts/Either'

assert.deepStrictEqual(unsafeUnwrap(E.right(5)), 5)

Added in v0.1.0

unsafeUnwrapLeft

Unwrap the value from within an Either, throwing the inner value of Right if Right.

Signature

export declare const unsafeUnwrapLeft: <E>(x: Either<E, unknown>) => E
unsafeUnwrapLeft :: Either e unknown -> e

Example

import { unsafeUnwrapLeft } from 'fp-ts-std/Either'
import * as E from 'fp-ts/Either'

assert.deepStrictEqual(unsafeUnwrapLeft(E.left(5)), 5)

Added in v0.5.0