[Haskell-cafe] Re: Indentation Creep

Aaron Denney wnoise at ofb.net
Fri Jul 13 19:47:23 EDT 2007

On 2007-07-13, Thomas Conway <drtomc at gmail.com> 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

More information about the Haskell-Cafe mailing list