All Projects → rvcas → remotedata-re

rvcas / remotedata-re

Licence: MIT license
Tools for fetching data from remote sources in Reason

Programming Languages

reason
219 projects

Projects that are alternatives of or similar to remotedata-re

bs-remotedata
RemoteData and WebData to use with bs-fetch for BuckleScript
Stars: ✭ 18 (-43.75%)
Mutual labels:  reasonml, remotedata
RemoteDataK
Algebraic data type (ADT) to represent the state of data that is loading from/to remote sources/destinations
Stars: ✭ 44 (+37.5%)
Mutual labels:  adt, remotedata
Klipse
Klipse is a JavaScript plugin for embedding interactive code snippets in tech blogs.
Stars: ✭ 2,841 (+8778.13%)
Mutual labels:  reasonml
Crocks
A collection of well known Algebraic Data Types for your utter enjoyment.
Stars: ✭ 1,501 (+4590.63%)
Mutual labels:  adt
ts-union
ADT sum type in typescript
Stars: ✭ 65 (+103.13%)
Mutual labels:  adt
Reason Graphql Fullstack
Fullstack Reason + GraphQL Todo List App
Stars: ✭ 246 (+668.75%)
Mutual labels:  reasonml
variant
Variant types in TypeScript
Stars: ✭ 147 (+359.38%)
Mutual labels:  adt
Wonder.js
🚀Functional, High performance 3D Webgl Engine
Stars: ✭ 225 (+603.13%)
Mutual labels:  reasonml
granary
Tezos smart contract & dapp development toolkit
Stars: ✭ 67 (+109.38%)
Mutual labels:  reasonml
abap-adt-api
Abap Developer Tools client
Stars: ✭ 25 (-21.87%)
Mutual labels:  adt
AndroidDevTools
收集整理Android开发所需的Android SDK、开发中用到的工具、Android开发教程、Android设计规范,免费的设计素材等。
Stars: ✭ 7,284 (+22662.5%)
Mutual labels:  adt
scala-3-crash-course
Scala 3 workshop presenting the top new features of the language.
Stars: ✭ 34 (+6.25%)
Mutual labels:  adt
apropos
Fast strong typed 'Either' data structure for typescript and flow
Stars: ✭ 20 (-37.5%)
Mutual labels:  adt
Re Web
Experimental web framework for ReasonML & OCaml
Stars: ✭ 237 (+640.63%)
Mutual labels:  reasonml
Layoutcast
Cast android code and resource changes to the running application through ADB.
Stars: ✭ 1,714 (+5256.25%)
Mutual labels:  adt
Relude
FP-inspired prelude/standard library for ReasonML projects
Stars: ✭ 230 (+618.75%)
Mutual labels:  reasonml
rocket-pipes
Powerful pipes for TypeScript, that chain Promise and ADT for you 🚌 -> ⛰️ -> 🚠 -> 🏂 -> 🚀
Stars: ✭ 18 (-43.75%)
Mutual labels:  adt
Structures
Collection of abstract data structures implemented in Java
Stars: ✭ 99 (+209.38%)
Mutual labels:  adt
bs-spectacle
No description or website provided.
Stars: ✭ 15 (-53.12%)
Mutual labels:  reasonml
bs-examples
some small examples showing how to use bucklescript/reason
Stars: ✭ 20 (-37.5%)
Mutual labels:  reasonml

RemoteData

npm version Build Status license

For some background, read this post

Installation

npm install remotedata-re

# or yarn

yarn add remotedata-re

Then add it to bsconfig.json

{
  "bs-dependencies": [
    "remotedata-re"
  ]
}

Usage

type data = list(string);
type error = string;
type remoteData = RemoteData.t(data, data, error);

let debugLog = (v: remoteData) =>
  switch (v) {
  | RemoteData.NotAsked => "Not Asked"
  | Loading(previous) =>
    let s = Js.Array.joinWith(", ", previous->Belt.List.toArray);
    {j|Loading ($s)|j};
  | Success(data) =>
    let s = Js.Array.joinWith(" + ", data->Belt.List.toArray);
    {j|Success ($s)|j};
  | Failure(_error) => "Failure"
  };

Js.log(RemoteData.NotAsked->debugLog);
/* output: Not Asked */

Js.log(RemoteData.Loading(["foo", "bar"])->debugLog);
/* output: Loading (foo, bar)*/

Js.log(RemoteData.Success(["foo", "bar", "baz"])->debugLog);
/* output: Success (foo + bar + baz)*/

Js.log(RemoteData.Failure("oops")->debugLog);

Examples

Note

Inspiration: remotedata

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].