Luke Palmer wrote:
> I believe you can get what you want using the diagonal function from
> Control.Monad.Omega.
> 
> product xs ys = [ [ (x,y) | y <- ys ] | x <- xs ]
> diag2 xs ys = diagonal (product xs ys)
> 
> I think if you separate taking the cartesian product and flattening
> it, like this, you might have an easier time wrangling all the
> different variants you want.

Note that Control.Monad.Omega  is not a monad. The law of associativity
is broken, at least in a direct sense.


Regards,
apfelmus

--
http://apfelmus.nfshost.com

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to