Thanks Brian and Simon.<br><br>In case anyone is interested, this is now ticket 3005.<br><br>-Doug McClean<br><br><div class="gmail_quote">On Fri, Feb 6, 2009 at 10:55 AM, Simon Peyton-Jones <span dir="ltr"><<a href="mailto:simonpj@microsoft.com">simonpj@microsoft.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div link="blue" vlink="purple" lang="EN-GB">
<div>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">Douglas.</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">Good suggestion. I believe it's already been
proposed that typese are normalised (wrt type functions) before being
displayed, but I can't find the ticket. Do create a feature request
on Trac, with your example. Thanks!</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">Simon</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<div style="border-style: none none none solid; border-color: -moz-use-text-color -moz-use-text-color -moz-use-text-color blue; border-width: medium medium medium 1.5pt; padding: 0in 0in 0in 4pt;">
<div>
<div style="border-style: solid none none; border-color: rgb(181, 196, 223) -moz-use-text-color -moz-use-text-color; border-width: 1pt medium medium; padding: 3pt 0in 0in;">
<p><b><span style="font-size: 10pt;" lang="EN-US">From:</span></b><span style="font-size: 10pt;" lang="EN-US"> <a href="mailto:glasgow-haskell-users-bounces@haskell.org" target="_blank">glasgow-haskell-users-bounces@haskell.org</a>
[mailto:<a href="mailto:glasgow-haskell-users-bounces@haskell.org" target="_blank">glasgow-haskell-users-bounces@haskell.org</a>] <b>On Behalf Of </b>Douglas
McClean<br>
<b>Sent:</b> Friday, February 06, 2009 5:32 AM<br>
<b>To:</b> <a href="mailto:glasgow-haskell-users@haskell.org" target="_blank">glasgow-haskell-users@haskell.org</a><br>
<b>Subject:</b> Display of associated types in GHCi</span></p>
</div>
</div><div><div></div><div class="Wj3C7c">
<p> </p>
<p>I have a question about the display of names for associated
types in GHCi.<br>
<br>
I have a module with a matrix type constructor:<br clear="all">
<br>
> data (Natural r, Natural c) => Matrix r c t = Matrix [[t]] deriving
(Eq)<br>
<br>
which uses type-level naturals to provide dimension checking.<br>
<br>
A type class for multiplication:<br>
<br>
> class Multiply a b where<br>
> type Product a b<br>
> times :: a -> b -> Product a b<br>
<br>
and an instance for matrix multiplication:<br>
<br>
> instance (Natural a, Natural b, Natural c, Num t) => Multiply (Matrix a
b t) (Matrix b c t) where<br>
> type Product (Matrix a b t) (Matrix b c t) = Matrix a c t<br>
> times m1 m2 = ...<br>
<br>
All of this works really well, I get dimension checking (and inference), and
lot of other goodies.<br>
<br>
My question has to do with the following GHCi session:<br>
<br>
*Main> let a = matrix two two [[1,1],[2,6]]<br>
*Main> :t a<br>
a :: Matrix Two Two Integer<br>
*Main> :t a `times` a<br>
a `times` a :: Product<br>
(Matrix Two Two Integer) (Matrix Two Two Integer)<br>
<br>
Am I correct that the type denoted by "Product (Matrix Two Two Integer)
(Matrix Two Two Integer)" is always "Matrix Two Two Integer"? It
certainly behaves that way in more complicated expressions, which is desirable.<br>
<br>
If so, could someone explain the reason why GHCi chooses not to simplify such
types for display? Could it? Is there a reason why such simplification would be
undesirable (when it is possible, I understand that it wouldn't be if type
variables were present)?<br>
<br>
Thanks,<br>
Doug McClean</p>
</div></div></div>
</div>
</div>
</blockquote></div><br><br clear="all"><br>-- <br>J. Douglas McClean<br><br>(781) 561-5540 (cell)<br>