<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, May 5, 2015 at 12:58 PM, Michael Orlitzky <span dir="ltr"><<a href="mailto:michael@orlitzky.com" target="_blank">michael@orlitzky.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div id=":1wi" class="" style="overflow:hidden">I use CmdArgs for this. I think the simplest example is,<br>
<br>
  <a href="https://hackage.haskell.org/package/email-validator" target="_blank">https://hackage.haskell.org/package/email-validator</a><br>
<br>
And one with multiple modes:<br>
<br>
  <a href="https://hackage.haskell.org/package/hath" target="_blank">https://hackage.haskell.org/package/hath</a><br>
<br>
It's not *quite* what you asked for: I use e.g. `hath -i file` to mean<br>
the same thing as `hath < file`, but that's as close as I got.<br></div></blockquote></div><div class="gmail_extra"><br></div>I also use CmdArgs, though I'm not positive it's still the best choice. eddie (<a href="http://chiselapp.com/user/mwm/repository/eddie/doc/tip/README.md">http://chiselapp.com/user/mwm/repository/eddie/doc/tip/README.md</a>) correctly handles the cases you want, and in additions makes:</div><div class="gmail_extra"><br></div><div class="gmail_extra">$ cat cat file1 file2 file3 | ./prog</div><div class="gmail_extra">$ ./prog file1 file2 file3</div><div class="gmail_extra"><br></div><div class="gmail_extra">do the same thing. However, it's a bit complicated, as eddie has multiple interacting options, an accumulating option, and defaults the first argument to an option and the rest to files to be processed. Figure out the simpler examples first.</div><div class="gmail_extra"><br></div></div>