[Haskell-cafe] Question on type synonym definition and language
extensions
Olivier Boudry
olivier.boudry at gmail.com
Thu May 29 21:39:39 EDT 2008
On Thu, May 29, 2008 at 7:36 PM, Antoine Latter <aslatter at gmail.com> wrote:
> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20080529/358d739c/attachment.htm
More information about the Haskell-Cafe
mailing list