-
-
Notifications
You must be signed in to change notification settings - Fork 502
ReaderT
Giulio Canti edited this page Sep 15, 2022
·
1 revision
Problem
I am searching for some type like
ReaderIOEither
I cannot find it infp-ts
, what can I do?
Solution
You can build what you need by using IOEither
+ ReaderT
.
Here's a sketch
import * as IOE from 'fp-ts/IOEither'
import * as ReaderT from 'fp-ts/ReaderT'
export interface ReaderIOEither<R, E, A> {
(r: R): IOE.IOEither<E, A>
}
declare module 'fp-ts/HKT' {
interface URItoKind3<R, E, A> {
readonly ReaderIOEither: ReaderIOEither<R, E, A>
}
}
export const map = /*#__PURE__*/ ReaderT.map(IOE.Functor)
export const ap = /*#__PURE__*/ ReaderT.ap(IOE.ApplyPar)
export const chain = /*#__PURE__*/ ReaderT.chain(IOE.Chain)
// etc...