&gt;&gt;  If I&#39;m running register outside runWriterT everything will work.<br><br>Maybe just<br><br>&gt; lift $ register $ print &quot;freed2&quot;<br><br>or I didn&#39;t catch something?<br><br><br><br><div class="gmail_quote">
2012/3/1 Alexander V Vershilov <span dir="ltr">&lt;<a href="mailto:alexander.vershilov@gmail.com">alexander.vershilov@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello.<br>
<br>
I&#39;m trying to add monad stack into network-conduit, and everything<br>
works except some details [1].<br>
<br>
I&#39;ve run runReaderT $ runTCPServer (wrapper around runResourceT) and<br>
inside conduit I want to run writer to gather results of inner computation.<br>
In inner computation I want to use IO, data from outter stack (ReaderT)<br>
so I&#39;m running {-1-}:<br>
<br>
  (k,t) &lt;- lift $ runWriterT $ ask &gt;&gt;= \x -&gt; tell [x]     {- 1 -}<br>
<br>
and {-2-}<br>
<br>
  (k,t) &lt;- lift $ runWriterT $ do {- 2 -}<br>
                    x &lt;- ask<br>
                    liftIO $ print $x+1<br>
                    tell [x]<br>
<br>
and that will work (except I&#39;ve thought I should not lift runWriterT, but<br>
calling functions inside.<br>
<br>
And finally in computation that will run once I want to register cleaning<br>
function (for example register $ putStrLn &quot;cleaned&quot;) ({-3-})<br>
<br>
  (k,t) &lt;- lift $ runWriterT $ do {- 3 -}<br>
                    x &lt;- ask<br>
                    liftIO $ print $x+1<br>
                    register $ print &quot;freed2&quot;<br>
                    tell [x]<br>
<br>
but I&#39;ve got type error. If I&#39;m running register outside runWriterT everything<br>
will work.<br>
<br>
I would apperated if there will be any suggestions how to make this code<br>
better or use register in internal computation (runWriterT)<br>
<br>
[1] <a href="https://gist.github.com/1941151" target="_blank">https://gist.github.com/1941151</a><br>
--<br>
Best regards,<br>
  Alexander V Vershilov<br>
<br>_______________________________________________<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>
<br></blockquote></div><br>