Apropos
Fast strong typed 'Either' data structure for typescript and flow
$ npm install --save apropos
API
//@flow
of
: Apropos<void, R>
Create pure right-handed value, left-handed type is empty. Exports by default
ofL
: Apropos<L, void>
Create pure left-handed value, right-handed type is empty.
Right
: Apropos<L, R>
Create right-handed value, left-handed type is inferred from usage.
Technically, Right
returns the same as of
; the difference is only in the type inference.
Left
: Apropos<L, R>
Create left-handed value, right-handed type is inferred from usage
is
: boolean
Checks whether an object is an instance of Apropos
makeError
<Context Tag> extends Error tag: Tag data: Context : <Context>(data: Context) => AnnotatedError<Context, Tag>
Create fabric for generating tagged error constructors.
Useful in .mapL
.
See annotated errors
Instance methods
-
isRight
-
isLeft
-
equals
-
thru
-
orElse
-
swap
-
promise
-
fold
Maps
-
map
-
mapR
-
mapL
-
bimap
Taps
-
tap
-
tapR
-
tapL
-
bitap
Chains
-
chain
-
chainR
-
chainL
-
bichain
Conditions
-
cond
-
chainCond
-
logic
Combinations
-
alt
-
and
-
ap
Annotated errors
positiveNum.foldconsole.logx, console.errorx // => Annotated Error: 'Negative number' -1
The project is released under the Mit License