[Haskell-beginners] Deforesting binary tree operations?

Neal Alexander wqeqweuqy at hotmail.com
Thu Feb 12 03:44:08 EST 2009


Is it possible to deforest something like this?



data Matrix a = Scalar a
               | Matrix (Matrix a,Matrix a,Matrix a,Matrix a)


(*) (Matrix (a11,a12,a21,a22)) (Matrix (b11,b12,b21,b22)) =

         Matrix ( (a11 * b11) + (a12 * b21),
                  (a11 * b12) + (a12 * b22),
                  (a21 * b11) + (a22 * b21),
                  (a21 * b12) + (a22 * b22) )

(*) (Scalar a) (Scalar b) = Scalar (a * b)



More information about the Beginners mailing list