Hyperlinkv0.8.0-beta.28

Trie

Trie.getUnsafeconsteffect/Trie.ts:585
(key: string): <V>(self: Trie<V>) => V
<V>(self: Trie<V>, key: string): V

Looks up the value for the specified key in the Trie unsafely.

When to use

Use when the trie key is known to exist and a missing key should be treated as a programming error.

Gotchas

getUnsafe throws if the key is not found. Use get instead to safely get a value from the Trie.

Example (Looking up values unsafely)

import { Trie } from "effect"
import * as assert from "node:assert"

const trie = Trie.empty<number>().pipe(
  Trie.insert("call", 0),
  Trie.insert("me", 1)
)

assert.throws(() => Trie.getUnsafe(trie, "mae"))
unsafe
Source effect/Trie.ts:5854 lines
export const getUnsafe: {
  (key: string): <V>(self: Trie<V>) => V
  <V>(self: Trie<V>, key: string): V
} = TR.getUnsafe