Experimenting with a simple hash table algorithm, seemed to work for me using Data.HashMap. I am hoping to understand better how to implement a mutable hash table (would this be Data.HashTable.IO?) that would allow for faster performance. I am totally lost...tried to modify the example here but could not find my way through the IO types I got in return (pun intended)...thanks in advance for any kind walk-through or reference to one.
For example, how to implement this simple exercise using a mutable hash table?
import qualified Data.HashMap as HM (toList,lookup,insert,empty)
f list = g list HM.empty where
g [] h = HM.toList h
g (x:xs) h = case HM.lookup (x-1) h of
Just _ -> g xs (HM.insert x (x + 1) h)
Nothing -> g xs (HM.insert x x h)