<br><br><div class="gmail_quote">2008/2/15 Antoine Latter &lt;<a href="mailto:aslatter@gmail.com">aslatter@gmail.com</a>&gt;:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
(sent to the list this time)<br><div class="Ih2E3d"><br>The problem is in the type-signature for from_seq:<br><br></div><div class="Ih2E3d">from_seq :: (Sequence seq) =&gt; (seq e) -&gt; (t e)<br><br></div><div class="Ih2E3d">
Neither the From_seq class or the type signature of the from_seq<br>function place any restrictions on the type of e, so the type can be<br>rewritten as:<br><br>from_seq :: forall e seq . Sequence seq =&gt; (seq e) -&gt; (t e)<br>
<br>That is, the class explicitly defines from_seq has having norestrictions on e.<br><br>Your from_seq&#39; function requires the type e (in the error, e1) to<br>inhabit IArray a e.<br><br>The IArray constraint isn&#39;t compatible with the From_seq class<br>
definition. &nbsp;You may need to explore multi-parameter type classes:<br><a href="http://en.wikibooks.org/wiki/Haskell/Advanced_type_classes" target="_blank">http://en.wikibooks.org/wiki/Haskell/Advanced_type_classes</a><br>
<br>Does this help?<br></div></blockquote></div><br>Yes, this helped.&nbsp; I added the type variable, e, to my From_seq class and it worked.&nbsp; Thank you for the explanation.&nbsp;&nbsp; Here are the changes I made:<br><br><span style="font-family: courier new,monospace;">class From_seq t e where</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; from_seq :: (Sequence seq) =&gt; (seq e) -&gt; (t e)</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">instance From_seq [] e where</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; from_seq seq </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; | snull seq&nbsp; = []</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; | otherwise = (shead seq) : (from_seq (stail seq))</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">instance (Ix i, Num i, IArray a e) =&gt; From_seq (a i) e where</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; from_seq seq = from_seq&#39; seq</span><br style="font-family: courier new,monospace;"><br>