If a newbie considers this as something natural, this is another reason for syntactic sugaring of HList:<div><br></div><div><a href="http://www.haskell.org/pipermail/haskell-cafe/2011-April/090986.html">http://www.haskell.org/pipermail/haskell-cafe/2011-April/090986.html</a><br>
<br><div class="gmail_quote">2011/10/2 Du Xi <span dir="ltr"><<a href="mailto:sdiyazg@sjtu.edu.cn">sdiyazg@sjtu.edu.cn</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
--I tried to write such polymorphic function:<br>
<br>
expand (x,y,z) = (x,y,z)<br>
expand (x,y) = (x,y,1)<br>
<br>
--And it didn't compile. Then I added a type signature:<br>
<br>
expand::a->b<br>
expand (x,y,z) = (x,y,z)<br>
expand (x,y) = (x,y,1)<br>
<br>
--It still didn't compile. I think the reason is that the following is disallowed:<br>
<br>
f::a->b<br>
f x = x<br>
<br>
--Is it possible to get around this and write the "expand" function? Of course, x and y may be of different types<br>
<br>
<br>
<br>
______________________________<u></u>_________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/<u></u>mailman/listinfo/haskell-cafe</a><br>
</blockquote></div><br></div>