<p>Hi, a java-programmer running into trouble while trying to learn Haskell.<br></p><p>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?</p>
<p>My attempt:</p><p></p><p>removeMaybeHash x =<br> case x of<br> Just ref -> ref<br> Nothing -> HashTable.new (==) (\key -> key)<br><br></p><p>test = do<br> h <- HashTable.new (==) (\key -> key)<br>
h1 <- HashTable.new (==) (\key -> key)<br> HashTable.insert h 3 h1<br> HashTable.insert h1 1 1000<br> maybeOuterHash <- HashTable.lookup h 3 <br> res <- removeMaybe (removeMaybeHash maybeOuterHash) 1000<br>
return res <br><br>Any clues?<br></p><p>In java this would be as simple as (pseudocode): h.lookup(3).lookup(1000)</p><p>Cheers,</p><p>Pedro</p>