16. 拡張可能バリアントの導入
variantFrom ::
Forall (KeyIs KnownSymbol) xs =>
RecordOf ParserInfo xs -> Parser (Variant xs)
variantFrom = subparser . subcmdVariant
where
subcmdVariant =
hfoldMapWithIndexFor (Proxy @ (KeyIs KnownSymbol))
$ m x ->
let k = symbolVal (proxyAssocKey m)
in command k
((EmbedAt m . Field . pure) <$> getField x)
instance Wrapper ParserInfo where
type Repr ParserInfo a = ParserInfo a
_Wrapper = id