Skip to content

Instantly share code, notes, and snippets.

@rjhilgefort
Created November 20, 2020 00:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rjhilgefort/b3f8fe77270006e969f79327028b79e7 to your computer and use it in GitHub Desktop.
Save rjhilgefort/b3f8fe77270006e969f79327028b79e7 to your computer and use it in GitHub Desktop.
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