I’d recommend taking a look at optparse-applicative. The library is very flexible and designed well.