If you search for skips lists implemented in Haskell, you won\'t find many. It is a probabilistic data structure needing a random number generator, meaning that any of these str
Random generators don't require IO
operations. They follow their own monadic laws (kinda derived from the State
monad) and are therefore representable through a Random
monad.
In case of the skip list, you could define your own monad that's able to carry around the probabilistic computation or just use standard Random
.
demo :: Random Int
demo = do
let l = SkipList.empty
l2 <- l `add` ("Hello", 42)
return $ l2 `get` "Hello"