This is the latest docs version
Quick Links
  • -Overview
  • -Language Features
  • -JS Interop
  • -Build System
Documentation
Language Manual
Reference for all language features
ReScript & React
First class bindings for ReactJS
GenType
Seamless TypeScript integration
Reanalyze
Dead Code & Termination analysis
Exploration
Packages
Explore third party libraries and bindings
Syntax Lookup
Discover all syntax constructs
APIPlaygroundBlogCommunity
  • Playground
  • Blog
  • Twitter
  • GitHub
  • Forum
Belt Module
Overview
Belt
submodules
  • Array
  • Float
  • HashMap
    • String
    • Int
    HashSet
    • String
    • Int
    Id
    • MakeHashable
    • MakeHashableU
    • MakeComparable
    • MakeComparableU
  • Int
  • List
  • Map
    • Dict
    • String
    • Int
    MutableMap
    • String
      • t
        key
      • t
        t
      • v
        make
      • v
        clear
      • v
        isEmpty
      • v
        has
      • v
        cmpU
      • v
        cmp
      • v
        eqU
      • v
        eq
      • v
        forEachU
      • v
        forEach
      • v
        reduceU
      • v
        reduce
      • v
        everyU
      • v
        every
      • v
        someU
      • v
        some
      • v
        size
      • v
        toList
      • v
        toArray
      • v
        fromArray
      • v
        keysToArray
      • v
        valuesToArray
      • v
        minKey
      • v
        minKeyUndefined
      • v
        maxKey
      • v
        maxKeyUndefined
      • v
        minimum
      • v
        minUndefined
      • v
        maximum
      • v
        maxUndefined
      • v
        get
      • v
        getUndefined
      • v
        getWithDefault
      • v
        getExn
      • v
        checkInvariantInternal
      • v
        remove
      • v
        removeMany
      • v
        set
      • v
        updateU
      • v
        update
      • v
        mapU
      • v
        map
      • v
        mapWithKeyU
      • v
        mapWithKey
    • Int
  • MutableQueue
  • MutableSet
    • String
    • Int
  • MutableStack
  • Option
  • Range
  • Result
  • Set
    • Dict
    • String
    • Int
    SortArray
    • String
    • Int
    API / Belt / Mutablemap / String

    String

    key

    RESCRIPT
    type key = string

    t

    RESCRIPT
    type t<'a>

    make

    RESCRIPT
    let make: unit => t<'a>

    clear

    RESCRIPT
    let clear: t<'a> => unit

    isEmpty

    RESCRIPT
    let isEmpty: t<'a> => bool

    has

    RESCRIPT
    let has: (t<'a>, key) => bool

    cmpU

    RESCRIPT
    let cmpU: (t<'a>, t<'a>, ('a, 'a) => int) => int

    cmp

    RESCRIPT
    let cmp: (t<'a>, t<'a>, ('a, 'a) => int) => int

    cmp(m1, m2, cmp). First compare by size, if size is the same, compare by key, value pair

    eqU

    RESCRIPT
    let eqU: (t<'a>, t<'a>, ('a, 'a) => bool) => bool

    eq

    RESCRIPT
    let eq: (t<'a>, t<'a>, ('a, 'a) => bool) => bool

    eq(m1, m2, cmp)

    forEachU

    RESCRIPT
    let forEachU: (t<'a>, (key, 'a) => unit) => unit

    forEach

    RESCRIPT
    let forEach: (t<'a>, (key, 'a) => unit) => unit

    forEach(m, f) applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The application order of f is in increasing order.

    reduceU

    RESCRIPT
    let reduceU: (t<'a>, 'b, ('b, key, 'a) => 'b) => 'b

    reduce

    RESCRIPT
    let reduce: (t<'a>, 'b, ('b, key, 'a) => 'b) => 'b

    reduce(m, a, f) computes (f kN dN ... (f k1 d1 a)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

    everyU

    RESCRIPT
    let everyU: (t<'a>, (key, 'a) => bool) => bool

    every

    RESCRIPT
    let every: (t<'a>, (key, 'a) => bool) => bool

    every(m, p) checks if all the bindings of the map satisfy the predicate p. The application order of p is unspecified.

    someU

    RESCRIPT
    let someU: (t<'a>, (key, 'a) => bool) => bool

    some

    RESCRIPT
    let some: (t<'a>, (key, 'a) => bool) => bool

    some(m, p) checks if at least one binding of the map satisfy the predicate p. The application order of p is unspecified.

    size

    RESCRIPT
    let size: t<'a> => int

    toList

    RESCRIPT
    let toList: t<'a> => list<(key, 'a)>

    In increasing order

    toArray

    RESCRIPT
    let toArray: t<'a> => array<(key, 'a)>

    In increasing order

    fromArray

    RESCRIPT
    let fromArray: array<(key, 'a)> => t<'a>

    keysToArray

    RESCRIPT
    let keysToArray: t<'a> => array<key>

    valuesToArray

    RESCRIPT
    let valuesToArray: t<'a> => array<'a>

    minKey

    RESCRIPT
    let minKey: t<'a> => option<key>

    minKeyUndefined

    RESCRIPT
    let minKeyUndefined: t<'a> => Js.undefined<key>

    maxKey

    RESCRIPT
    let maxKey: t<'a> => option<key>

    maxKeyUndefined

    RESCRIPT
    let maxKeyUndefined: t<'a> => Js.undefined<key>

    minimum

    RESCRIPT
    let minimum: t<'a> => option<(key, 'a)>

    minUndefined

    RESCRIPT
    let minUndefined: t<'a> => Js.undefined<(key, 'a)>

    maximum

    RESCRIPT
    let maximum: t<'a> => option<(key, 'a)>

    maxUndefined

    RESCRIPT
    let maxUndefined: t<'a> => Js.undefined<(key, 'a)>

    get

    RESCRIPT
    let get: (t<'a>, key) => option<'a>

    getUndefined

    RESCRIPT
    let getUndefined: (t<'a>, key) => Js.undefined<'a>

    getWithDefault

    RESCRIPT
    let getWithDefault: (t<'a>, key, 'a) => 'a

    getExn

    RESCRIPT
    let getExn: (t<'a>, key) => 'a

    checkInvariantInternal

    RESCRIPT
    let checkInvariantInternal: t<'a> => unit

    raise when invariant is not held

    remove

    RESCRIPT
    let remove: (t<'a>, key) => unit

    remove(m, x) do the in-place modification

    removeMany

    RESCRIPT
    let removeMany: (t<'a>, array<key>) => unit

    set

    RESCRIPT
    let set: (t<'a>, key, 'a) => unit

    set(m, x, y) do the in-place modification, return m for chaining. If x was already bound in m, its previous binding disappears.

    updateU

    RESCRIPT
    let updateU: (t<'a>, key, option<'a> => option<'a>) => unit

    update

    RESCRIPT
    let update: (t<'a>, key, option<'a> => option<'a>) => unit

    mapU

    RESCRIPT
    let mapU: (t<'a>, 'a => 'b) => t<'b>

    map

    RESCRIPT
    let map: (t<'a>, 'a => 'b) => t<'b>

    map(m, f) returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

    mapWithKeyU

    RESCRIPT
    let mapWithKeyU: (t<'a>, (key, 'a) => 'b) => t<'b>

    mapWithKey

    RESCRIPT
    let mapWithKey: (t<'a>, (key, 'a) => 'b) => t<'b>
    Types and values
    • t
      key
    • t
      t
    • v
      make
    • v
      clear
    • v
      isEmpty
    • v
      has
    • v
      cmpU
    • v
      cmp
    • v
      eqU
    • v
      eq
    • v
      forEachU
    • v
      forEach
    • v
      reduceU
    • v
      reduce
    • v
      everyU
    • v
      every
    • v
      someU
    • v
      some
    • v
      size
    • v
      toList
    • v
      toArray
    • v
      fromArray
    • v
      keysToArray
    • v
      valuesToArray
    • v
      minKey
    • v
      minKeyUndefined
    • v
      maxKey
    • v
      maxKeyUndefined
    • v
      minimum
    • v
      minUndefined
    • v
      maximum
    • v
      maxUndefined
    • v
      get
    • v
      getUndefined
    • v
      getWithDefault
    • v
      getExn
    • v
      checkInvariantInternal
    • v
      remove
    • v
      removeMany
    • v
      set
    • v
      updateU
    • v
      update
    • v
      mapU
    • v
      map
    • v
      mapWithKeyU
    • v
      mapWithKey

    © 2024 The ReScript Project

    Software and assets distribution powered by KeyCDN.

    About
    • Community
    • ReScript Association
    Find us on