Module Relude_Globals
This module is intended to be used as a global open (e.g. open
Relude.Globals;
) to bring the most core/common Relude modules, types, and functions into scope for use in your code.
If you are interested in using a global open for Relude, it's recommended that you globally open this module rather than open Relude
, because the core Relude
module aliases every module from Relude and its purpose is to serve as a root namespace for the library, not as a module to be globally opened.
We are intentionally shadowing various stdlib/Belt module names here (like Array
/List
/String
), because we feel we have provided enough functionality with the corresponding Relude module that we want to explicitly shadow other similarly-named modules.
For some other modules, like Js
we are prefixing our version with R
because the Relude Js
module is not a replacement for the BuckleScript Js
module, it is more an extension to it.
NB: When making changes to this module, keep in mind that you will likely be affecting other people who have globally opened this module, so only expose very core/common things, and be careful about accidental shadowing of module names or functions.
Usage
open Relude.Globals;
let x = List.map(a => a + 2, [1, 2, 3]); // Relude.List
let y = IO.pure(42); // Relude.IO
let (>>): ('a => 'b) => ('b => 'c) => 'a => 'c;
let (<<): ('a => 'b) => ('c => 'a) => 'c => 'b;
let id: 'a => 'a;
let const: 'a => 'b => 'a;
let flip: ('a => 'b => 'c) => 'b => 'a => 'c;
let absurd: Void.t => 'a;
let inverse: bool => bool;