<div dir="ltr">This is slightly off-topic, but you might be interested in the <a href="http://hackage.haskell.org/package/layers-0.1/docs/Documentation-Layers-Overview.html">monad-layers</a> package that obviates the need for a function like liftN.<br>

<br>Thanks,<br>Arjun<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Oct 17, 2013 at 1:44 PM, Wvv <span dir="ltr"><<a href="mailto:vitea3v@rambler.ru" target="_blank">vitea3v@rambler.ru</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Thank you!<br>
<br>
Unfortunately, liftN always take same number of arguments.<br>
So, polyvariadic "magic" don't work here.<br>
<br>
<br>
wren ng thornton wrote<br>
<div class="im">> On 10/16/13 5:06 PM, Wvv wrote:<br>
>> I try to write a function "liftN", but I'm not satisfied with result.<br>
>><br>
>> lift :: (MonadTrans t) => Monad m => m a -> t m a<br>
>><br>
>> liftN n<br>
>> š š š| n < 1 š š š = error "liftN: n<1"<br>
>> š š š| n == 1 š š = lift<br>
>> š š š| otherwise = lift . (liftN (n-1))<br>
>><br>
>> 1) I know(?), that it is impossible to write liftN now: typechecker can't<br>
>> decide which signature it is.<br>
><br>
> You should check out the solutions for encoding polyvariadic functions,<br>
> e.g.<br>
><br>
> *<br>
</div>> &lt;<a href="http://community.haskell.org/~wren/wren-extras/dist/doc/html/wren-extras/Data-List-ZipWithN.html&gt" target="_blank">http://community.haskell.org/~wren/wren-extras/dist/doc/html/wren-extras/Data-List-ZipWithN.html&gt</a>;<br>


> * &lt;<a href="http://okmij.org/ftp/Haskell/polyvariadic.html#polyvartype-fn&gt" target="_blank">http://okmij.org/ftp/Haskell/polyvariadic.html#polyvartype-fn&gt</a>;<br>
> * &lt;<a href="http://paczesiowa.blogspot.com/2010/03/generalized-zipwithn.html&gt" target="_blank">http://paczesiowa.blogspot.com/2010/03/generalized-zipwithn.html&gt</a>;<br>
> *<br>
> &lt;<a href="http://hackage.haskell.org/package/TypeCompose-0.9.9/docs/Data-Zip.html&gt" target="_blank">http://hackage.haskell.org/package/TypeCompose-0.9.9/docs/Data-Zip.html&gt</a>;<br>
<div class="im">><br>
> --<br>
> Live well,<br>
> ~wren<br>
> _______________________________________________<br>
> Haskell-Cafe mailing list<br>
<br>
> Haskell-Cafe@<br>
<br>
</div>> <a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
<br>
<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://haskell.1045720.n5.nabble.com/liftN-tp5738612p5738648.html" target="_blank">http://haskell.1045720.n5.nabble.com/liftN-tp5738612p5738648.html</a><br>
<div class="im HOEnZb">Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.<br>
</div><div class="HOEnZb"><div class="h5">_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a 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>