[Haskell-cafe] Indentation Creep

Neil Mitchell ndmitchell at gmail.com
Fri Jul 13 17:19:33 EDT 2007


Hi

> In particular, I wrote a Trie implementation.

Neat, I often feel I should be using one of those, but never do
because Data.Map is just too temptingly close by.

A couple of the combinators can be used to simplify some bits:

>         case v of
>             Nothing -> return True
>             Just _  -> return False

becomes:

<   isNothing v

>            if e
>                  then writeTVar p Empty
>                  else return ()

< when e $ writeTVar p Empty

There all so seem to be some other common bits:

>                           case re of
>                               False -> writeTVar m Nothing
>                               True  -> writeTVar p Empty

Perhaps that could become a function?

Thanks

Neil


More information about the Haskell-Cafe mailing list