Created
November 20, 2020 00:42
-
-
Save rjhilgefort/b3f8fe77270006e969f79327028b79e7 to your computer and use it in GitHub Desktop.
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 { tap, prop, chain, invoker, map } from 'ramda'; | |
// https://monet.github.io/monet.js/ | |
import { Maybe, Just, Some } from 'monet'; | |
// https://github.com/fluture-js/Fluture | |
import { encaseP, fork } from 'fluture'; | |
const { log, error } = console; | |
const fetchF = (...args) => | |
encaseP(fetch)(...args) | |
.pipe(chain(encaseP(invoker(0, 'json')))) | |
fetchF('https://pokeapi.co/api/v2/pokemon/ditto') | |
.pipe(map(tap(log))) | |
.pipe(map(prop('weight'))) | |
.pipe(fork(error)(log)) | |
//Maybe.of('a').cata(r.identity, r.identity) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment