IndentOpt Existential Type
Opened this issue · 1 comments
The current definition of IndentOpt
exposes the type variable b
representing the type of block elements to be parsed. In my opinion it makes more sense to existentially quantify this variable in the constructors instead. This gives block parsers more flexibility on the type of items they are parsing.
The current definition is like this:
data IndentOpt m a b
= IndentNone a
| IndentMany (Maybe Pos) ([b] -> m a) (m b)
| IndentSome (Maybe Pos) ([b] -> m a) (m b)
and I am suggesting changing it to:
data IndentOpt m a
= IndentNone a
| forall b. IndentMany (Maybe Pos) ([b] -> m a) (m b)
| forall b. IndentSome (Maybe Pos) ([b] -> m a) (m b)
This also gives the type a straightforward Functor
instance.
Is this a change you would consider accepting? It is not backwards compatible and would require the ExistentialQuantification
extension. I'd be happy to make a PR.
This is probably better typing in this case, yes. It would make sense to merge this if we ever decide to bump the major version, but I'm not sure when that will happen.