← Back

Source

these

Functor2<URI> & Bifunctor2<URI> & Foldable2v2<URI> & Traversable2v2<URI>

Added in v1.0.0 (instance)

These

type These<L, A> = This<L, A> | That<L, A> | Both<L, A>

Added in v1.0.0 (data)

A data structure providing “inclusive-or” as opposed to Either’s “exclusive-or”.

If you interpret Either<L, A> as suggesting the computation may either fail or succeed (exclusively), then These<L, A> may fail, succeed, or do both at the same time.

There are a few ways to interpret the both case:

Another way you can think of These<L, A> is saying that we want to handle L kind of data, A kind of data, or both L and A kind of data at the same time. This is particularly useful when it comes to displaying UI’s.

(description adapted from https://package.elm-lang.org/packages/joneshf/elm-these)

bimap

<M, B>(f: (l: L) => M, g: (a: A) => B): These<M, B>

Added in v1.0.0 (method)

fold

<B>(this_: (l: L) => B, that: (a: A) => B, both: (l: L, a: A) => B): B

Added in v1.0.0 (method)

Applies a function to each case in the data structure

inspect

(): string

Added in v1.0.0 (method)

isBoth

(): this is Both<L, A>

Added in v1.0.0 (method)

Returns true if the these is Both, false otherwise

isThat

(): this is That<L, A>

Added in v1.0.0 (method)

Returns true if the these is That, false otherwise

isThis

(): this is This<L, A>

Added in v1.0.0 (method)

Returns true if the these is This, false otherwise

map

<B>(f: (a: A) => B): These<L, B>

Added in v1.0.0 (method)

reduce

<B>(b: B, f: (b: B, a: A) => B): B

Added in v1.0.0 (method)

toString

(): string

Added in v1.0.0 (method)

both

<L, A>(l: L, a: A): These<L, A>

Added in v1.0.0 (function)

fromThese

<L, A>(defaultThis: L, defaultThat: A) => (fa: These<L, A>): [L, A]

Added in v1.0.0 (function)

getMonad

<L>(S: Semigroup<L>): Monad2C<URI, L>

Added in v1.0.0 (function)

getSemigroup

<L, A>(SL: Semigroup<L>, SA: Semigroup<A>): Semigroup<These<L, A>>

Added in v1.0.0 (function)

getSetoid

<L, A>(SL: Setoid<L>, SA: Setoid<A>): Setoid<These<L, A>>

Added in v1.0.0 (function)

isBoth

<L, A>(fa: These<L, A>): fa is Both<L, A>

Added in v1.0.0 (function)

Returns true if the these is an instance of Both, false otherwise

isThat

<L, A>(fa: These<L, A>): fa is That<L, A>

Added in v1.0.0 (function)

Returns true if the these is an instance of That, false otherwise

isThis

<L, A>(fa: These<L, A>): fa is This<L, A>

Added in v1.0.0 (function)

Returns true if the these is an instance of This, false otherwise

that

Alias of of

Added in v1.0.0 (function)

theseLeft

<L, A>(fa: These<L, A>): Option<L>

Added in v1.0.0 (function)

theseRight

<L, A>(fa: These<L, A>): Option<A>

Added in v1.0.0 (function)

this_

<L, A>(l: L): These<L, A>

Added in v1.0.0 (function)