In the spirit of the question I asked here, (Generically) Build Parsers from custom data types? @danidiaz supplied a solution that works beautifully.
I'd like to do a little more like this: if f
is an instance of a HasParser
, a list of f
is also an instance of the HasParser
. Or in Haskell, that is
instance (HasParser f) => HasParser [f] where
getParser = many' (getParser @f)
Well, this would not compile. I get the following error message:
error: Not in scope: type variable ‘f’
I am unfamiliar with the syntax with these language extensions. In particular, the usage of @
with Proxy
always confuses me a lot. Hope some one can show me where to find the best documentation to read.