Skip to content

Find a way to avoid writing O(n^2) conversions #27

@djspiewak

Description

@djspiewak

This is the current state of the ^^ syntax in parseback. It is done in this way to achieve two goals:

  • The parameter to ^^ should be an arity-n function, where n is the number of chained type parameters within the target Parser of the form A ~ B ~ ... ~ N
  • The parameter to ^^should be fully type inferred, allowing for the use of lambdas without explicit type parameters

The reason there is a quadratic number of cases stems from the fact that we need to provide a separate, specific syntax class for each possible reassociation of the ~ type constructor. Obviously it would be much nicer to just write a linear number of cases (one for each arity, presumably) and then build some implicit machinery which would convince implicit search to generate the quadratic portion, but my efforts in that direction have thus far been unsuccessful.

Paging @milessabin and @travisbrown for thoughts and assistance if they feel so inclined!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions