On 2007-07-13, Thomas Conway <[EMAIL PROTECTED]> wrote: > Hi All, > > In the best spirit of Haskelling, I thought I'd try dropping in a > completely different data structure in a spot where I thought the > existing one was (1) ugly (2) leaking memory. In particular, I wrote a > Trie implementation. Now the point is actually not much to do with the > data structure itself, but code layout. I mention this particular data > structure only because it is the one I was working on, but it seems to > come up quite often. > > Consider the following function: > > data Trie t = Empty | Trie (TriePtr t) (MaybePtr t) (TriePtr t) > type TriePtr t = TVar (Trie t) > type MaybePtr t = TVar (Maybe t)
It might be a bit clearer if every level of the tree were a flat map of pointers. You can even parametrize on this map type... -- Aaron Denney -><- _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe