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
    • Int
  • MutableQueue
  • MutableSet
    • String
      • t
        value
      • t
        t
      • v
        make
      • v
        fromArray
      • v
        fromSortedArrayUnsafe
      • v
        copy
      • v
        isEmpty
      • v
        has
      • v
        add
      • v
        addCheck
      • v
        mergeMany
      • v
        remove
      • v
        removeCheck
      • v
        removeMany
      • v
        union
      • v
        intersect
      • v
        diff
      • v
        subset
      • v
        cmp
      • v
        eq
      • v
        forEachU
      • v
        forEach
      • v
        reduceU
      • v
        reduce
      • v
        everyU
      • v
        every
      • v
        someU
      • v
        some
      • v
        keepU
      • v
        keep
      • v
        partitionU
      • v
        partition
      • v
        size
      • v
        toList
      • v
        toArray
      • v
        minimum
      • v
        minUndefined
      • v
        maximum
      • v
        maxUndefined
      • v
        get
      • v
        getUndefined
      • v
        getExn
      • v
        split
      • v
        checkInvariantInternal
    • Int
  • MutableStack
  • Option
  • Range
  • Result
  • Set
    • Dict
    • String
    • Int
    SortArray
    • String
    • Int
    API / Belt / Mutableset / String

    String

    This module is Belt.MutableSet specialized with key type to be a primitive type.

    It is more efficient in general, the API is the same with Belt.MutableSet except its key type is fixed, and identity is not needed(using the built-in one)

    See Belt.MutableSet

    value

    RESCRIPT
    type value = string

    The type of the set elements.

    t

    RESCRIPT
    type t

    The type of sets.

    make

    RESCRIPT
    let make: unit => t

    fromArray

    RESCRIPT
    let fromArray: array<value> => t

    fromSortedArrayUnsafe

    RESCRIPT
    let fromSortedArrayUnsafe: array<value> => t

    copy

    RESCRIPT
    let copy: t => t

    isEmpty

    RESCRIPT
    let isEmpty: t => bool

    has

    RESCRIPT
    let has: (t, value) => bool

    add

    RESCRIPT
    let add: (t, value) => unit

    addCheck

    RESCRIPT
    let addCheck: (t, value) => bool

    mergeMany

    RESCRIPT
    let mergeMany: (t, array<value>) => unit

    remove

    RESCRIPT
    let remove: (t, value) => unit

    removeCheck

    RESCRIPT
    let removeCheck: (t, value) => bool

    removeMany

    RESCRIPT
    let removeMany: (t, array<value>) => unit

    union

    RESCRIPT
    let union: (t, t) => t

    intersect

    RESCRIPT
    let intersect: (t, t) => t

    diff

    RESCRIPT
    let diff: (t, t) => t

    subset

    RESCRIPT
    let subset: (t, t) => bool

    cmp

    RESCRIPT
    let cmp: (t, t) => int

    eq

    RESCRIPT
    let eq: (t, t) => bool

    forEachU

    RESCRIPT
    let forEachU: (t, value => unit) => unit

    forEach

    RESCRIPT
    let forEach: (t, value => unit) => unit

    In increasing order

    reduceU

    RESCRIPT
    let reduceU: (t, 'a, ('a, value) => 'a) => 'a

    reduce

    RESCRIPT
    let reduce: (t, 'a, ('a, value) => 'a) => 'a

    Iterate in increasing order.

    everyU

    RESCRIPT
    let everyU: (t, value => bool) => bool

    every

    RESCRIPT
    let every: (t, value => bool) => bool

    every(p, s) checks if all elements of the set satisfy the predicate p. Order unspecified.

    someU

    RESCRIPT
    let someU: (t, value => bool) => bool

    some

    RESCRIPT
    let some: (t, value => bool) => bool

    some(p, s) checks if at least one element of the set satisfies the predicate p. Oder unspecified.

    keepU

    RESCRIPT
    let keepU: (t, value => bool) => t

    keep

    RESCRIPT
    let keep: (t, value => bool) => t

    keep(s, p) returns a fresh copy of the set of all elements in s that satisfy predicate p.

    partitionU

    RESCRIPT
    let partitionU: (t, value => bool) => (t, t)

    partition

    RESCRIPT
    let partition: (t, value => bool) => (t, t)

    partition(s, p) returns a fresh copy pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate p, and s2 is the set of all the elements of s that do not satisfy p.

    size

    RESCRIPT
    let size: t => int

    toList

    RESCRIPT
    let toList: t => list<value>

    In increasing order with respect

    toArray

    RESCRIPT
    let toArray: t => array<value>

    In increasing order with respect

    minimum

    RESCRIPT
    let minimum: t => option<value>

    minUndefined

    RESCRIPT
    let minUndefined: t => Js.undefined<value>

    maximum

    RESCRIPT
    let maximum: t => option<value>

    maxUndefined

    RESCRIPT
    let maxUndefined: t => Js.undefined<value>

    get

    RESCRIPT
    let get: (t, value) => option<value>

    getUndefined

    RESCRIPT
    let getUndefined: (t, value) => Js.undefined<value>

    getExn

    RESCRIPT
    let getExn: (t, value) => value

    split

    RESCRIPT
    let split: (t, value) => ((t, t), bool)

    split(s, key) return a fresh copy of each

    checkInvariantInternal

    RESCRIPT
    let checkInvariantInternal: t => unit

    raise when invariant is not held

    Types and values
    • t
      value
    • t
      t
    • v
      make
    • v
      fromArray
    • v
      fromSortedArrayUnsafe
    • v
      copy
    • v
      isEmpty
    • v
      has
    • v
      add
    • v
      addCheck
    • v
      mergeMany
    • v
      remove
    • v
      removeCheck
    • v
      removeMany
    • v
      union
    • v
      intersect
    • v
      diff
    • v
      subset
    • v
      cmp
    • v
      eq
    • v
      forEachU
    • v
      forEach
    • v
      reduceU
    • v
      reduce
    • v
      everyU
    • v
      every
    • v
      someU
    • v
      some
    • v
      keepU
    • v
      keep
    • v
      partitionU
    • v
      partition
    • v
      size
    • v
      toList
    • v
      toArray
    • v
      minimum
    • v
      minUndefined
    • v
      maximum
    • v
      maxUndefined
    • v
      get
    • v
      getUndefined
    • v
      getExn
    • v
      split
    • v
      checkInvariantInternal

    © 2024 The ReScript Project

    Software and assets distribution powered by KeyCDN.

    About
    • Community
    • ReScript Association
    Find us on