{-# LANGUAGE ScopedTypeVariables #-}
module Main where
import qualified Data.HashTable.IO as I
import Data.Maybe (fromJust,isJust)
import System.Environment (getArgs)
main :: IO ()
main = do
args <- getArgs
let a = [([z,t],x) | x <- ['a'..'d'], z <- ['f'..'t'], t <- ['a'..'p'], [x,z,t] <= "fnf"]
b :: I.CuckooHashTable String Char <- I.fromList a
c <- I.lookup b ("kn")
let d1 u = do
d <- I.lookup b u
print c
if isJust d
then putStrLn . show . fromJust $ d
else putStrLn "Nothing"
return ()
if null args
then d1 "fa"
else d1 (head $ args)
so it works. And the library documentation says that a complexity of Cuckoo hash lookup is about O(1), but with hashing there are questions of ratio of fulfilling the buckets and collisions.
So, my library having the very generic constraints can be used instead.
Oleksandr Zhabenko.