Skip to content

IndentOpt Existential Type #565

Open
@eayus

Description

@eayus

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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions