Decode overview
Defines a Decoder
, namely a function that receives an unknown
value and tries to decodes it in an A
value.
It returns an Either
with a string
as Left
when decoding fails or an A
as Right
when decoding succeeds.
Added in v0.5.0
Table of contents
Alt
alt
Signature
export declare const alt: <A>(that: () => Decoder<A>) => (fa: Decoder<A>) => Decoder<A>
Added in v0.5.0
Apply
ap
Signature
export declare const ap: <A>(fa: Decoder<A>) => <B>(fab: Decoder<(a: A) => B>) => Decoder<B>
Added in v0.5.0
apFirst
Signature
export declare const apFirst: <B>(fb: Decoder<B>) => <A>(fa: Decoder<A>) => Decoder<A>
Added in v0.5.0
apSecond
Signature
export declare const apSecond: <B>(fb: Decoder<B>) => <A>(fa: Decoder<A>) => Decoder<B>
Added in v0.5.0
Functor
map
Signature
export declare const map: <A, B>(f: (a: A) => B) => (fa: Decoder<A>) => Decoder<B>
Added in v0.5.0
Monad
chain
Signature
export declare const chain: <A, B>(f: (a: A) => Decoder<B>) => (ma: Decoder<A>) => Decoder<B>
Added in v0.5.0
chainFirst
Signature
export declare const chainFirst: <A, B>(f: (a: A) => Decoder<B>) => (ma: Decoder<A>) => Decoder<A>
Added in v0.5.0
flatten
Signature
export declare const flatten: <A>(mma: Decoder<Decoder<A>>) => Decoder<A>
Added in v0.5.0
combinators
orElse
Signature
export declare const orElse: <A>(f: (e: string) => Decoder<A>) => (ma: Decoder<A>) => Decoder<A>
Added in v0.5.0
constructors
left
Signature
export declare const left: <A = never>(e: string) => Decoder<A>
Added in v0.5.0
right
Signature
export declare const right: <A>(a: A) => Decoder<A>
Added in v0.5.0
instances
URI
Signature
export declare const URI: 'elm-ts/Decoder'
Added in v0.5.0
URI (type alias)
Signature
export type URI = typeof URI
Added in v0.5.0
decoder
Signature
export declare const decoder: Monad1<'elm-ts/Decoder'> & Alternative1<'elm-ts/Decoder'>
Added in v0.5.0
model
Decoder (interface)
Signature
export interface Decoder<A> extends ReaderEither<unknown, string, A> {}
Added in v0.5.0