relude-fetch
Overview
Relude interop library for the Browser
Fetch API.
This can also be used in Node.js using a polyfill like
isomorphic-fetch.
This library basically wraps the
bs-fetch Bucklescript library
to lift any publicly-exposed Js.Promise.t('a)
values into Relude.IO.t('a, Js.Promise.error)
values. Using IO
rather than Promise
makes error
handling 100% more explicit, allows for better composability with other
effect and error types, and unlocks the full power of monads!
Examples
See the tests for example usage.
Also see the demo for real-world usage, such as file uploads.
Developer info
Scripts
# Normal development scripts
> npm run clean
> npm run build
> npm run cleanbuild
> npm run test
> npm run cleantest
> npm run watch
# Run the demo project via parcel
> npm run demo
Publishing to npm
> npm version major|minor|patch
> git push origin --follow-tags
> git push upstream --follow-tags
> npm publish
NixOS
> nix-shell
%nix%> npm install