> I'm using memoized copying functions to maximize sharing in a
> tree/dag. It works under Hugs but not GHCi 5.03 on Windows
> XP. I'm stuck here and so would sure appreciate some help.
> I've attached a simple demo module with examples that
> illustrate the problem.
There are some differences between Hugs & GHC's memo table
implementations, and some shortcomings in the GHC implementation. The
main difference is that Hugs uses not just pointer equality but also
real equality when the keys in the hash table are Int or Char; GHC
doesn't do this. In GHC, making a memo table with Int or Char keys
really doesn't work too well - our memo table implementation is geared
towards using pointer equality for dynamic objects. On the other hand,
GHC's memo tables support garbage collection of hash table entries (as
you well know :-), whereas Hugs's memo tables will grow for ever.
The equality difference explains the behaviour you're seeing: when you
memo-copy the tree, GHC doesn't find any hits because the labels at each
node are Ints. It should be easy enough to construct your own memo
table implementation that is specialised to Int, though, and use this
instead of the generic Memo.memo whenever you need a memo table with Int
keys.
Hope this helps...
Cheers,
Simon
_______________________________________________
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs