I find to be filling in a lot of record fields from the cli parameters and it would be much faster to have some generic way of generating parser code.
data AB f = AB {a :: f Int, b :: f String}
type ProgramType :: Type -> Type
type family ProgramType a
genericOptions :: forall (mkOption :: Symbol -> Symbol) (mkName :: Symbol -> Symbol) p b m a. Generic a => (a -> ParserT p m b) -> ParserT (ProgramType (Rep a) & p) m b)
Which genericOptions @("--" ++) @ID @(AB Maybe) would generate something like
\f ->
opt @"--a" @"a" $ \a ->
opt @"--b" @"b" $ \b ->
f AB {..}
There seems like there could be several versions for Opt Arg Flag.
Does this make sense or is there a better way?
I find to be filling in a lot of record fields from the cli parameters and it would be much faster to have some generic way of generating parser code.
Which
genericOptions @("--" ++) @ID @(AB Maybe)would generate something likeThere seems like there could be several versions for Opt Arg Flag.
Does this make sense or is there a better way?