Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Prospero.Map

An efficient implementation of maps from keys to values based on immutable red-black trees.

Types

data Map k v
  = Map { tree : Tree k v }
  waiving Eq, Ord

Instances

Functions

delete : forall k v. Ord k => k -> Map k v -> Map k v

Returns the result of deleting the supplied key k from the map m.

difference : forall k v w. Ord k => Map k v -> Map k w -> Map k v

Returns the difference of two Maps.

empty : forall k v. Map k v

Returns the empty Map.

fromList : forall k v. Ord k => List { key : k, value : v } -> Map k v

Returns a Map constructed from a list of key value pairs.

insert : forall k v. Ord k => k -> v -> Map k v -> Map k v

Returns the result of inserting a new key k and value v into the Map.

intersection : forall k v w. Ord k => Map k v -> Map k w -> Map k v

Returns the intersection of two Maps.

lookup : forall k v. Ord k => k -> Map k v -> Option v

Returns the value at a supplied key k in the Map if possible.

singleton : forall k v. k -> v -> Map k v

Returns a map with a single supplied element with key k and value v.

size : forall k v. Map k v -> Int

Returns the size of the Map.

toList : forall k v. Map k v -> List { key : k, value : v }

Returns a List of key value pairs built from the contents of the supplied Map.

union : forall k v. Ord k => Map k v -> Map k v -> Map k v

Returns the union of two Maps.