
2008/5/29 Olivier Boudry
After some "read, guess, try, error" cycles I came up with this:
type Matrix = forall m. forall a. forall i. forall n. (Ix i, MArray a n m, Num i, Num n) => m (a (i,i) n)
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. -Antoine -Antoine