You find point I need the correct type signatures.<div>And seems like it is (missed IO in your description)</div><div><div>Kleisli IO FilePath [FilePath]</div><div><br></div><div>Thanks a lot!</div><div><br clear="all">-Haisheng<br>
<br><br><div class="gmail_quote">On Tue, Jun 28, 2011 at 12:38 AM, Ertugrul Soeylemez <span dir="ltr"><<a href="mailto:es@ertes.de">es@ertes.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">Haisheng Wu <<a href="mailto:freizl@gmail.com">freizl@gmail.com</a>> wrote:<br>
<br>
> I'm wondering if it is possible doing IO in terms of Arrow.<br>
> I got a function search all files under directory recursively and<br>
> I'd like to refartoring using Arrow terms.<br>
<br>
</div>Yes, it's possible using Kleisli, but it's not very convenient, because<br>
you need the Kleisli wrapper around everything. Also usually there is<br>
really little reason to do that, because monads are more expressive.<br>
For example they allow you to encode computations with only outputs<br>
directly, without wrapping them in a computation, which takes a stub<br>
argument.<br>
<div class="im"><br>
<br>
> I tried to define a function like below but failed.<br>
> isDirExist = Kleisli doesDirectoryExist<br>
><br>
> Do I need to define a instance for IO to be Arrow? Or is there any<br>
> existing solutions?<br>
<br>
</div>No, the needed instances are already there, but you need to change your<br>
type signatures:<br>
<br>
myGetFilesInDir :: Kleisli FilePath [FilePath]<br>
<br>
<br>
Greets,<br>
Ertugrul<br>
<br>
<br>
--<br>
nightmare = unsafePerformIO (getWrongWife >>= sex)<br>
<a href="http://ertes.de/" target="_blank">http://ertes.de/</a><br>
<br>
<br>
<br>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/mailman/listinfo/beginners</a><br>
</blockquote></div><br></div></div>