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>&gt; data (Natural r, Natural c) =&gt; 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>&gt; class Multiply a b where<br>&gt;&nbsp; type Product a b<br>&gt;&nbsp; times :: a -&gt; b -&gt; Product a b<br><br>
and an instance for matrix multiplication:<br><br>&gt; instance (Natural a, Natural b, Natural c, Num t) =&gt; Multiply (Matrix a b t) (Matrix b c t) where<br>&gt;&nbsp; type Product (Matrix a b t) (Matrix b c t) = Matrix a c t<br>
&gt;&nbsp; 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&gt; let a = matrix two two [[1,1],[2,6]]<br>
*Main&gt; :t a<br>a :: Matrix Two Two Integer<br>*Main&gt; :t a `times` a<br>a `times` a :: Product<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (Matrix Two Two Integer) (Matrix Two Two Integer)<br><br>Am I correct that the type denoted by &quot;Product (Matrix Two Two Integer) (Matrix Two Two Integer)&quot; is always &quot;Matrix Two Two Integer&quot;? 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&#39;t be if type variables were present)?<br>
<br>Thanks,<br>Doug McClean<br>