On Thu, May 29, 2008 at 7:36 PM, Antoine Latter <<a href="mailto:aslatter@gmail.com">aslatter@gmail.com</a>> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I've tried similar things before. You may run into subtle problems later.<br>
<br>
Such as:<br>
<br>
> transpose :: Matrix -> Matrix<br>
<br>
won't expand into the type signature you want it to, I think.<br>
<br>
You probably want that to be equivalent to:<br>
<br>
transpose :: forall m. forall a. forall i. forall n. (Ix i, MArray a<br>
n m, Num i, Num n) => m (a (i,i) n) -> m (a (i,i) n)<br>
<br>
But you'll get:<br>
<br>
transpose :: forall m. forall a. forall i. forall n. (Ix i, MArray a<br>
n m, Num i, Num n) => Matrix -> m (a (i,i) n)<br>
<br>
which means that the first argument must be a polymorphic value, which<br>
isn't very useful.<br>
<br>
</blockquote></div><br>Right, this is exactly what I'm getting when creating a transpose function:<br><br> *Main> :t transpose<br> transpose :: (MArray a Double m) => Matrix Int Double -> m (a (Int, Int) Double)<br>
<br>Thanks for sharing your experience. I'll try to stay out of the subtle bugs and keep it verbose but simple.<br><br>Regards,<br><br>Olivier.<br>