<html>
<head>
<meta content="text/html; charset=ISO-8859-2"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<tt>Thanks.<br>
I think this is the simplest solution.<br>
<br>
Dušan<br>
<br>
</tt>
<div class="moz-cite-prefix">On 03/07/2014 10:37 AM, Tobias Brandt
wrote:<br>
</div>
<blockquote
cite="mid:CAOOWqirVeTRiURCLwyRSFbwQjPnH8zdC1-AvYLhj7hEKm6idAw@mail.gmail.com"
type="cite">
<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
moz-do-not-send="true" 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
moz-do-not-send="true"
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 moz-do-not-send="true"
href="http://www.haskell.org/haskellwiki/Heterogenous_collections"
target="_blank">http://www.haskell.org/haskellwiki/Heterogenous_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 moz-do-not-send="true"
href="http://folding.stanford.edu/" target="_blank">http://folding.stanford.edu/</a><br>
<br>
<br>
<a moz-do-not-send="true" href="http://Van.Tuyl.eu/"
target="_blank">http://Van.Tuyl.eu/</a><br>
<a moz-do-not-send="true"
href="http://members.chello.nl/hjgtuyl/tourdemonad.html"
target="_blank">http://members.chello.nl/hjgtuyl/tourdemonad.html</a><br>
Haskell programming<br>
--<br>
<br>
</blockquote>
<br>
<br>
<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a moz-do-not-send="true"
href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br>
<a moz-do-not-send="true"
href="http://www.haskell.org/mailman/listinfo/haskell-cafe"
target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
</body>
</html>