+1 on Control.Monad.Omega.  In point of fact, your diagN function is simply<br><br>diagN = runOmega . mapM Omega<br><br>You&#39;ll find it an interesting exercise to grok the source of Control.Monad.Omega, obviously, but essentially, you&#39;re replacing concatMap with a fair (diagonal) traversal order version.<br>

<br clear="all">Louis Wasserman<br><a href="mailto:wasserman.louis@gmail.com">wasserman.louis@gmail.com</a><br><a href="http://profiles.google.com/wasserman.louis">http://profiles.google.com/wasserman.louis</a><br>