
On Thu, May 29, 2008 at 7:36 PM, Antoine Latter
I've tried similar things before. You may run into subtle problems later.
Such as:
transpose :: Matrix -> Matrix
won't expand into the type signature you want it to, I think.
You probably want that to be equivalent to:
transpose :: forall m. forall a. forall i. forall n. (Ix i, MArray a n m, Num i, Num n) => m (a (i,i) n) -> m (a (i,i) n)
But you'll get:
transpose :: forall m. forall a. forall i. forall n. (Ix i, MArray a n m, Num i, Num n) => Matrix -> m (a (i,i) n)
which means that the first argument must be a polymorphic value, which isn't very useful.
Right, this is exactly what I'm getting when creating a transpose function: *Main> :t transpose transpose :: (MArray a Double m) => Matrix Int Double -> m (a (Int, Int) Double) Thanks for sharing your experience. I'll try to stay out of the subtle bugs and keep it verbose but simple. Regards, Olivier.