Created
November 4, 2019 11:58
-
-
Save effe-megna/ae20cb22145072de55d40606dfc63448 to your computer and use it in GitHub Desktop.
monad ReaderRemoteData
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Reader } from 'fp-ts/lib/Reader' | |
import { Monad3 } from 'fp-ts/lib/Monad' | |
import * as RD from "@devexperts/remote-data-ts" | |
import { getReaderM } from 'fp-ts/lib/ReaderT' | |
import { pipeable } from "fp-ts/lib/pipeable" | |
declare module 'fp-ts/lib/HKT' { | |
interface URItoKind3<R, E, A> { | |
ReaderRemoteData: ReaderRemoteData<R, E, A> | |
} | |
} | |
export interface ReaderRemoteData<R, E, A> extends Reader<R, RD.RemoteData<E, A>> { } | |
const { map, ap, of, chain } = getReaderM(RD.remoteData) | |
const monadReaderRemoteData: Monad3<'ReaderRemoteData'> = { | |
URI: 'ReaderRemoteData', | |
map, | |
ap, | |
of, | |
chain | |
} | |
export const RRD = pipeable(monadReaderRemoteData) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment