Why not use an ordered pair as the key?

Regards,

John A. De Goes
N-BRAIN, Inc.
The Evolution of Collaboration

http://www.n-brain.net    |    877-376-2724 x 101

On Apr 13, 2009, at 9:42 AM, John Smith wrote:

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

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to