Hi, a java-programmer running into trouble while trying to learn Haskell.
I try to make a hash containing hashes but can not getting a value out of the innermost hash - I keep running into type-trouble where IO and Maybe monad is getting mixed?
My attempt:
removeMaybeHash x =
case x of
Just ref -> ref
Nothing -> HashTable.new (==) (\key -> key)
test = do
h <- HashTable.new (==) (\key -> key)
h1 <- HashTable.new (==) (\key -> key)
HashTable.insert h 3 h1
HashTable.insert h1 1 1000
maybeOuterHash <- HashTable.lookup h 3
res <- removeMaybe (removeMaybeHash maybeOuterHash) 1000
return res
Any clues?
In java this would be as simple as (pseudocode): h.lookup(3).lookup(1000)
Cheers,
Pedro