<div dir="ltr"><div><div><div>The problem is, that the type parameter 'a' of the functions in the list is fixed. You can work around that with RankNTypes:<br><br></div>newtype Wrap = Wrap { unwrap :: forall a. [a] -> a }<br>

<br></div>unwrap $ (\(h:t) -> (unwrap h) t) [Wrap head, Wrap last]<br><br></div>This specializes the type of the functions at every point of use separately.</div><div class="gmail_extra"><br><br><div class="gmail_quote">
On 7 March 2014 09:14, Kolář Dušan <span dir="ltr"><<a href="mailto:kolar@fit.vutbr.cz" target="_blank">kolar@fit.vutbr.cz</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Well my fault, the example should have been like this:<br>
<br>
We have and error of infinite type for<br>
Prelude> :t ((\(h:t) -> h t) [head, last, head, last, head, last])<br>
<br>
Of course, head and tail are incompatible on type level...<span class="HOEnZb"><font color="#888888"><br>
<br>
Dušan</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Fri, 07 Mar 2014 07:57:09 +0100, Kolář Dušan <<a href="mailto:kolar@fit.vutbr.cz" target="_blank">kolar@fit.vutbr.cz</a>> wrote:<br>
<br>
:<br>
:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
But we have an error of infinite type construction for<br>
<br>
Prelude> :t ((\(h:t) -> h t) [head,tail, head, tail, head, tail])<br>
<br>
Well I can overcome this by encoding functions into data types and then performing "conversion" back and forth, nevertheless, is there any way how to overcome this?<br>
</blockquote>
<br>
It seems like you need heterogenous collections[0]<br>
<br>
Regards,<br>
Henk-Jan van Tuyl<br>
<br>
<br>
[0] <a href="http://www.haskell.org/haskellwiki/Heterogenous_collections" target="_blank">http://www.haskell.org/<u></u>haskellwiki/Heterogenous_<u></u>collections</a><br>
<br>
<br>
-- <br>
Folding@home<br>
What if you could share your unused computer power to help find a cure? In just 5 minutes you can join the world's biggest networked computer and get us closer sooner. Watch the video.<br>
<a href="http://folding.stanford.edu/" target="_blank">http://folding.stanford.edu/</a><br>
<br>
<br>
<a href="http://Van.Tuyl.eu/" target="_blank">http://Van.Tuyl.eu/</a><br>
<a href="http://members.chello.nl/hjgtuyl/tourdemonad.html" target="_blank">http://members.chello.nl/<u></u>hjgtuyl/tourdemonad.html</a><br>
Haskell programming<br>
--<br>
<br>
</blockquote>
<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>
</div></div></blockquote></div><br></div>