Skip to content

Files

Latest commit

 

History

History
This branch is up to date with reazen/relude:main.

docs

Relude

GitHub CI npm Coveralls

Relude is a ReasonML/OCaml standard library replacement ("prelude") written in ReasonML, targeting compilation to JavaScript via the Melange compiler.

Relude aims to provide a robust collection of modules, types, and functions built on top of reusable typeclass-style abstractions, with a focus on day-to-day practical use. Relude has its foundation on the math concepts found in most modern pure functional languages, but our goal is to make the library as easy-to-use as a library like Lodash for those who don't know or care about the underlying abstractions. This is made possible by OCaml's module system and the foundational work that has gone into bs-bastet, on which much of Relude is based.

The API of Relude is inspired by PureScript's Prelude, as well as other FP ecosystems including Scala, Haskell, and Elm.

Relude is currently at a 0.x version as the API and library organization settles, but we feel the library is quite stable and comprehensive, and is in-use in production at several companies that we know about. The main Relude authors use the library every day and the development is driven by actual application needs and use-cases, but all backed by the abstractions and principles we love from languages like Haskell/PureScript/Scala/etc. We're not trying to re-create Haskell in OCaml/ReasonML - we just want to have some of the abstractions available to us in a pragmatic format.

That said, we feel the library is usable by all ReasonML users, not just experts. There will be some learning involved, but we hope to aid that with blog posts and more documentation, and answering questions or trying to give advice (if we feel qualified). The beauty of using these common abstractions is that we don't have to take the full responsibility for explaining everything from scratch, as there are countless other resources and FP experts out there to help too.

The API is comprehensive in terms of the tools you likely need for day-to-day application development - we have utilities for all the core data types (string, int, float, list, array, option, Result, functions, tuples etc.), some of our own types (AsyncResult, AsyncData, Ior, Validation, ListZipper, Void, etc.), a general purpose bi-functor IO effect type, basic monad transformers, and a typeclass-based extension system to grant all of our types with consistent and principled extensions and operators.

The ideas and concepts in this library come from the rich history of category theory, abstract algebra, and typed functional programming libraries like Haskell, Scala, PureScript, and many others, and we are just humble students.

Quick links

Ecosystem

The Reazen GitHub organization, and some individual contributors have a variety of libraries that are built with Relude:

GitHub Build Package Description
relude GitHub CI npm ReasonML prelude/standard library
relude-csv GitHub CI npm Pure functional CSV parser library
relude-eon GitHub CI npm a native Reason/OCaml date/time library
relude-fetch GitHub CI npm an interop and utility library for the fetch API
relude-parse GitHub CI npm a monadic string parsing library
relude-random GitHub CI npm Pure functional pseudo-random value generation
relude-reason-react GitHub CI npm utilities for ReasonReact based on Relude types and conventions
relude-url GitHub CI npm URL/URI utilities
bs-decode CircleCI npm a JSON decoding library inspired by the Elm JSON Decode Pipeline

Upcoming

Below are some libraries which may be coming soon to the Relude ecosystem:

  • relude-color - a color manipulation library
  • relude-rationaljs-future - an interop library for rationaljs/future
  • See reazen#24 for more discussion

Contact

Contributing

We are very open to contributions and for community help - just let us know what you'd like to do, and if you want to discuss the approach before jumping in.