[Haskell-cafe] Fair diagonals

Twan van Laarhoven twanvl at gmail.com
Wed Nov 4 09:21:46 EST 2009

Sjoerd Visscher wrote:

> I believe this does what you want:
> <code>

The attached code should be more efficient, since it doesn't use integer indices.

Note that this is just a 'level' monad: the list is stratified into levels, when 
combining two levels, the level of the result is the sum of the levels of the 

     map (map sum) . runDiags . traverse each $ [[1..], [1..], [1..]]

I looked on hackage but I was surprised that I couldn't find this simple monad. 
The package level-monad does look very similar, only it uses a different list 
type for the representation.

By the way, it seems Omega intentionally doesn't use this design. To quote the 
documentation "... a breadth-first search of a data structure can fall short if 
it has an infinitely branching node. Omega addresses this problem ..."

-------------- next part --------------
A non-text attachment was scrubbed...
Name: MonadDiag.hs
Type: text/x-haskell
Size: 1226 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20091104/b0a07eb0/MonadDiag.bin

More information about the Haskell-Cafe mailing list