Hyperlinkv0.8.0-beta.28

HashMap

HashMap.setconsteffect/HashMap.ts:523
<K, V>(key: K, value: V): (self: HashMap<K, V>) => HashMap<K, V>
<K, V>(self: HashMap<K, V>, key: K, value: V): HashMap<K, V>

Sets the specified key to the specified value using the internal hashing function.

Example (Setting a value)

import { HashMap } from "effect"

const map1 = HashMap.make(["a", 1])
const map2 = HashMap.set(map1, "b", 2)

console.log(HashMap.size(map2)) // 2
console.log(HashMap.get(map2, "b")) // Option.some(2)

// Original map is unchanged
console.log(HashMap.size(map1)) // 1
transforming
Source effect/HashMap.ts:5234 lines
export const set: {
  <K, V>(key: K, value: V): (self: HashMap<K, V>) => HashMap<K, V>
  <K, V>(self: HashMap<K, V>, key: K, value: V): HashMap<K, V>
} = internal.set
Referenced by 5 symbols