Auto-generate a command-line parser for your datatype

Version on this page:1.4.4@rev:3
LTS Haskell 21.23:1.4.9
Stackage Nightly 2023-12-06:1.5.2
Latest on Hackage:1.5.2

See all snapshots optparse-generic appears in

BSD-3-Clause licensed by Gabriel Gonzalez
Maintained by Gabriel439@gmail.com
This version can be pinned in stack with:optparse-generic-1.4.4@sha256:3ad4624ae34193df88bee3d9af1f24e039482424d853fbbf854e7c711a41b5f8,1801

Module documentation for 1.4.4

This library auto-generates an optparse-applicative-compatible Parser from any data type that derives the Generic interface.

See the documentation in Options.Generic for an example of how to use this library



  • readIntegralBounded: use metavar in error message


  • Export internal readIntegralBounded utility
  • Build against optparse-applicative-


  • New unwrap function
    • This is the underlying utility that powers unwrap{Record,RecordPure,WithHelp}


  • Fix broken haddocks


  • BREAKING CHANGE: Add support for type-level default values
    • This is a breaking change because the various parse* typeclass methods now take an additional argument to support this feature


  • Export GenericParseRecord and getRecord{,PureWith}


  • BREAKING CHANGE: New metavar method for ParseField class
    • This field simplifies customizing ParseField instances
      • Now you usually only need to override metavar now or possibly also readField, whereas the default behavior for parseField should work more often
    • This is only a breaking change for data types that use the default implementation of ParseField but do not derive Typeable
    • You can migrate existing code that doesn’t compile by just explicitly specifying what the metavar field should be