On 05/05/2015 01:43 PM, Vale Cofer-Shabica wrote:
Hello all,
Punchline first: What's the "best practice" way of doing unix-style command line argument and file input processing in Haskell?
Background: I'm using Haskell to write programs that act like well-behaved, pipe-friendly unix tools. i.e., the following are all equivalent:
% ./prog file % ./prog < file % cat file | ./prog
Thus far, I've done this by directly inspecting the first element of System.Environment.getArgs, which has been fine thus far.
I use CmdArgs for this. I think the simplest example is, https://hackage.haskell.org/package/email-validator And one with multiple modes: https://hackage.haskell.org/package/hath It's not *quite* what you asked for: I use e.g. `hath -i file` to mean the same thing as `hath < file`, but that's as close as I got.