Sorry, i don&#39;t refer the paper on other email. But the paper was &quot;Helium, for Learning Haskell&quot;<br><br><div class="gmail_quote">No dia 10 de Outubro de 2010 12:22, André Batista Martins <span dir="ltr">&lt;<a href="mailto:andre_bm@netcabo.pt">andre_bm@netcabo.pt</a>&gt;</span> escreveu:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">I thanks for the answers.<br>On this paper, i found this example<br>&quot;The student has accidental given the arguments of map in the wrong<br>
order. Again, the logged student programs show that this is indeed<br>a common mistake.<br>
                  (1,8): Type error in application<br>                     expression : map [1 .. 10] even<br>                     term : map<br>                        type : (a -&gt; b) -&gt; [a] -&gt; [b]<br>                        does not match : [Int] -&gt; (Int -&gt; Bool) -&gt; c<br>

                     probable fix : re-order arguments<br>&quot;<br>The solution i think was in reordering of function arguments and the elements of a tuple, and the insertion or removal of function arguments.<br><br>In general, this problem appears also in sequence of functions. So if we do the bridge between the functions, and that bridge was one function to re-order the elements of output to the correct input of next function.<br>

<br>I think that work has been done, in helium compiler.  But i can&#39;t identify the algorithm for this propose.<br><br>How i can find the type of one function that i was done, on code, not on compiler?<br><br><br>Cheers,<br>

 André<br><br><br><br><br><br><div class="gmail_quote">No dia 10 de Outubro de 2010 07:58, Gene A <span dir="ltr">&lt;<a href="mailto:yumagene@gmail.com" target="_blank">yumagene@gmail.com</a>&gt;</span> escreveu:<div><div>
</div><div class="h5"><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br><br><div class="gmail_quote"><div>2010/10/9 André Batista Martins <span dir="ltr">&lt;<a href="mailto:andre_bm@netcabo.pt" target="_blank">andre_bm@netcabo.pt</a>&gt;</span> Said:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">


<br>Might have not been clear, but i will try illustrate .<div><br>f:: a-&gt; b -&gt; c -&gt; (b,(c,a))<br>f1 ::  c -&gt; a -&gt; d</div></blockquote></div><div>-----------------------------<br> <br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">


<div></div><br></blockquote></div>I think I would attack this with glue consisting of:<br><br>comb f f1 a b c =  arr (\(a,b,c) -&gt; f a b c) &gt;&gt;&gt; arr (\(b,(c,a))) -&gt;f1 c a) $ (a,b,c)<br><br>and yes, have to agree that easier to roll your own if only a few functions are like this..<br>


but should be able to parse the type signatures of the functions involved and write a program to automate this process.. using this format as a template.. <br><br>Actually if you just set it to take all the variables prior to last (-&gt;) in sig you can put them<br>


put them together in an uncurried format.. for instance the &quot;a -&gt; b -&gt; c&quot; portion would become always \(a,b,c) -&gt; then the function so arr (\(a,b,c) -&gt; f a b c) then the term (output) would be the last term in this case (b,(c,a)  add that with a &quot;-&gt;&quot; between to give that to first part of another lambda construction (\(c,a) -&gt; f1 c a) ... arrowizing the whole thing with arr (first lambda) &gt;&gt;&gt; arr (second lambda) $ and a tuple from all but the last variables in all cases of first function ... so for f it would be (a,b,c).  if for some odd reason it was a single it would just become ((a)) an added parenthesis, which would not hurt a thing for the case where it was a sig like f :: a -&gt; b<br>


<br>So for your case it becomes as shown above:<br>comb f f1 a b c =  arr (\(a,b,c) -&gt; f a b c) &gt;&gt;&gt; arr (\(b,(c,a))) -&gt;f1 c a) $ (a,b,c)<br>and say for:<br><br>f :: a -&gt; (b,c)<br>f1:: b -&gt; d<br><br>(\(a) -&gt; f a) &gt;&gt;&gt; (\(b,c) -&gt; f1 b) $ (a)   &lt;- it just harmlessly adds the &#39;( &#39; and &#39;)&#39; around the &#39;a&#39; even though it doesn&#39;t need it as the only parameter prior to the last &#39;-&gt;&#39;.   <br>


<br>This is probably clear as mud, on first look, but I think a way forward in automating from <br>this is possible.. I am sure of it.. but it would be at the source code level and a string parse and output from that .. <br>


<br>cheers,<br><font color="#888888">gene<br><br><br>
</font></blockquote></div></div></div><br>
</blockquote></div><br>