/usr/share/doc/libghc-hashtables-doc/html/Data-HashTable-Class.html is in libghc-hashtables-doc 1.0.1.8-2build2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Data.HashTable.Class</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_Data-HashTable-Class.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Data-HashTable-Class.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">hashtables-1.0.1.8: Mutable hash tables in the ST monad</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Safe Haskell</th><td>None</td></tr></table><p class="caption">Data.HashTable.Class</p></div><div id="description"><p class="caption">Description</p><div class="doc"><p>This module contains a <code><a href="Data-HashTable-Class.html#t:HashTable">HashTable</a></code> typeclass for the hash table
implementations in this package. This allows you to provide functions which
will work for any hash table implementation in this collection.
</p><p>It is recommended to create a concrete type alias in your code when using this
package, i.e.:
</p><pre> import qualified Data.HashTable.IO as H
type HashTable k v = H.BasicHashTable k v
foo :: IO (HashTable Int Int)
foo = do
ht <- H.new
H.insert ht 1 1
return ht
</pre><p>or
</p><pre> import qualified Data.HashTable.ST.Cuckoo as C
import qualified Data.HashTable.Class as H
type HashTable s k v = C.HashTable s k v
foo :: ST s (HashTable s k v)
foo = do
ht <- H.new
H.insert ht 1 1
return ht
</pre><p>Firstly, this makes it easy to switch to a different hash table
implementation, and secondly, using a concrete type rather than leaving your
functions abstract in the <code><a href="Data-HashTable-Class.html#t:HashTable">HashTable</a></code> class should allow GHC to optimize
away the typeclass dictionaries.
</p><p>Note that the functions in this typeclass are in the <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad-ST-Safe.html#t:ST">ST</a></code> monad; if you want
hash tables in <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a></code>, use the convenience wrappers in <a href="Data-HashTable-IO.html">Data.HashTable.IO</a>.
</p></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><span class="keyword">class</span> <a href="#t:HashTable">HashTable</a> h <span class="keyword">where</span><ul class="subs"><li><a href="#v:new">new</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad-ST-Safe.html#t:ST">ST</a> s (h s k v)</li><li><a href="#v:newSized">newSized</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Int.html#t:Int">Int</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad-ST-Safe.html#t:ST">ST</a> s (h s k v)</li><li><a href="#v:insert">insert</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Eq.html#t:Eq">Eq</a> k, <a href="/usr/share/doc/libghc-hashable-doc/html/Data-Hashable.html#t:Hashable">Hashable</a> k) => h s k v -> k -> v -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad-ST-Safe.html#t:ST">ST</a> s ()</li><li><a href="#v:delete">delete</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Eq.html#t:Eq">Eq</a> k, <a href="/usr/share/doc/libghc-hashable-doc/html/Data-Hashable.html#t:Hashable">Hashable</a> k) => h s k v -> k -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad-ST-Safe.html#t:ST">ST</a> s ()</li><li><a href="#v:lookup">lookup</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Eq.html#t:Eq">Eq</a> k, <a href="/usr/share/doc/libghc-hashable-doc/html/Data-Hashable.html#t:Hashable">Hashable</a> k) => h s k v -> k -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad-ST-Safe.html#t:ST">ST</a> s (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Maybe.html#t:Maybe">Maybe</a> v)</li><li><a href="#v:foldM">foldM</a> :: (a -> (k, v) -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad-ST-Safe.html#t:ST">ST</a> s a) -> a -> h s k v -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad-ST-Safe.html#t:ST">ST</a> s a</li><li><a href="#v:mapM_">mapM_</a> :: ((k, v) -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad-ST-Safe.html#t:ST">ST</a> s b) -> h s k v -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad-ST-Safe.html#t:ST">ST</a> s ()</li><li><a href="#v:computeOverhead">computeOverhead</a> :: h s k v -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad-ST-Safe.html#t:ST">ST</a> s <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a></li></ul></li><li class="src short"><a href="#v:fromList">fromList</a> :: (<a href="Data-HashTable-Class.html#t:HashTable">HashTable</a> h, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Eq.html#t:Eq">Eq</a> k, <a href="/usr/share/doc/libghc-hashable-doc/html/Data-Hashable.html#t:Hashable">Hashable</a> k) => [(k, v)] -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad-ST-Safe.html#t:ST">ST</a> s (h s k v)</li><li class="src short"><a href="#v:toList">toList</a> :: <a href="Data-HashTable-Class.html#t:HashTable">HashTable</a> h => h s k v -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad-ST-Safe.html#t:ST">ST</a> s [(k, v)]</li></ul></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src"><span class="keyword">class</span> <a name="t:HashTable" class="def">HashTable</a> h <span class="keyword">where</span><a href="src/Data-HashTable-Class.html#HashTable" class="link">Source</a></p><div class="doc"><p>A typeclass for hash tables in the <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad-ST-Safe.html#t:ST">ST</a></code> monad. The operations on these
hash tables are typically both key- and value-strict.
</p></div><div class="subs methods"><p class="caption">Methods</p><p class="src"><a name="v:new" class="def">new</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad-ST-Safe.html#t:ST">ST</a> s (h s k v)<a href="src/Data-HashTable-Class.html#new" class="link">Source</a></p><div class="doc"><p>Creates a new, default-sized hash table. <em>O(1)</em>.
</p></div><p class="src"><a name="v:newSized" class="def">newSized</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Int.html#t:Int">Int</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad-ST-Safe.html#t:ST">ST</a> s (h s k v)<a href="src/Data-HashTable-Class.html#newSized" class="link">Source</a></p><div class="doc"><p>Creates a new hash table sized to hold <code>n</code> elements. <em>O(n)</em>.
</p></div><p class="src"><a name="v:insert" class="def">insert</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Eq.html#t:Eq">Eq</a> k, <a href="/usr/share/doc/libghc-hashable-doc/html/Data-Hashable.html#t:Hashable">Hashable</a> k) => h s k v -> k -> v -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad-ST-Safe.html#t:ST">ST</a> s ()<a href="src/Data-HashTable-Class.html#insert" class="link">Source</a></p><div class="doc"><p>Inserts a key/value mapping into a hash table, replacing any existing
mapping for that key.
</p><p><em>O(n)</em> worst case, <em>O(1)</em> amortized.
</p></div><p class="src"><a name="v:delete" class="def">delete</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Eq.html#t:Eq">Eq</a> k, <a href="/usr/share/doc/libghc-hashable-doc/html/Data-Hashable.html#t:Hashable">Hashable</a> k) => h s k v -> k -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad-ST-Safe.html#t:ST">ST</a> s ()<a href="src/Data-HashTable-Class.html#delete" class="link">Source</a></p><div class="doc"><p>Deletes a key-value mapping from a hash table. <em>O(n)</em> worst case,
<em>O(1)</em> amortized.
</p></div><p class="src"><a name="v:lookup" class="def">lookup</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Eq.html#t:Eq">Eq</a> k, <a href="/usr/share/doc/libghc-hashable-doc/html/Data-Hashable.html#t:Hashable">Hashable</a> k) => h s k v -> k -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad-ST-Safe.html#t:ST">ST</a> s (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Maybe.html#t:Maybe">Maybe</a> v)<a href="src/Data-HashTable-Class.html#lookup" class="link">Source</a></p><div class="doc"><p>Looks up a key-value mapping in a hash table. <em>O(n)</em> worst case,
(<em>O(1)</em> for cuckoo hash), <em>O(1)</em> amortized.
</p></div><p class="src"><a name="v:foldM" class="def">foldM</a> :: (a -> (k, v) -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad-ST-Safe.html#t:ST">ST</a> s a) -> a -> h s k v -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad-ST-Safe.html#t:ST">ST</a> s a<a href="src/Data-HashTable-Class.html#foldM" class="link">Source</a></p><div class="doc"><p>A strict fold over the key-value records of a hash table in the <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad-ST-Safe.html#t:ST">ST</a></code>
monad. <em>O(n)</em>.
</p></div><p class="src"><a name="v:mapM_" class="def">mapM_</a> :: ((k, v) -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad-ST-Safe.html#t:ST">ST</a> s b) -> h s k v -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad-ST-Safe.html#t:ST">ST</a> s ()<a href="src/Data-HashTable-Class.html#mapM_" class="link">Source</a></p><div class="doc"><p>A side-effecting map over the key-value records of a hash
table. <em>O(n)</em>.
</p></div><p class="src"><a name="v:computeOverhead" class="def">computeOverhead</a> :: h s k v -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad-ST-Safe.html#t:ST">ST</a> s <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a><a href="src/Data-HashTable-Class.html#computeOverhead" class="link">Source</a></p><div class="doc"><p>Computes the overhead (in words) per key-value mapping. Used for
debugging, etc; time complexity depends on the underlying hash table
implementation. <em>O(n)</em>.
</p></div></div><div class="subs instances"><p id="control.i:HashTable" class="caption collapser" onclick="toggleSection('i:HashTable')">Instances</p><div id="section.i:HashTable" class="show"><table><tr><td class="src"><a href="Data-HashTable-Class.html#t:HashTable">HashTable</a> <a href="Data-HashTable-ST-Basic.html#t:HashTable">HashTable</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Data-HashTable-Class.html#t:HashTable">HashTable</a> <a href="Data-HashTable-ST-Cuckoo.html#t:HashTable">HashTable</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Data-HashTable-Class.html#t:HashTable">HashTable</a> <a href="Data-HashTable-ST-Linear.html#t:HashTable">HashTable</a></td><td class="doc empty"> </td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:fromList" class="def">fromList</a> :: (<a href="Data-HashTable-Class.html#t:HashTable">HashTable</a> h, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Eq.html#t:Eq">Eq</a> k, <a href="/usr/share/doc/libghc-hashable-doc/html/Data-Hashable.html#t:Hashable">Hashable</a> k) => [(k, v)] -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad-ST-Safe.html#t:ST">ST</a> s (h s k v)<a href="src/Data-HashTable-Class.html#fromList" class="link">Source</a></p><div class="doc"><p>Create a hash table from a list of key-value pairs. <em>O(n)</em>.
</p></div></div><div class="top"><p class="src"><a name="v:toList" class="def">toList</a> :: <a href="Data-HashTable-Class.html#t:HashTable">HashTable</a> h => h s k v -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad-ST-Safe.html#t:ST">ST</a> s [(k, v)]<a href="src/Data-HashTable-Class.html#toList" class="link">Source</a></p><div class="doc"><p>Given a hash table, produce a list of key-value pairs. <em>O(n)</em>.
</p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.13.2</p></div></body></html>
|