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.