AndrasKovacs / AndrasKovacs/flatparse

Levity polymorphism

Open
#5 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Haskell
Stars
178
Forks
18
PR merge metrics
No merged PRs in 30d

Description

Currently we can only return LiftedRep types from parsers. Sometimes this performs poorly, when we want to parse Int, Double, or other directly unboxable types. While sometimes it's possible to avoid boxing by using tail-recursive functions with unboxed accumulators, it's generally more convenient (and possibly more efficient) if we can use non-tail recursion and basic combinators with unboxed return values.

Unfortunately the ergonomics of levity polymorphism is awful. Example: https://hackage.haskell.org/package/bytesmith-0.3.7.0/docs/Data-Bytes-Parser-Rebindable.html I think something like this would be acceptable, but for the sake of usability more functions should be included in levity-polymorphic classes. This would require boilerplate (or code generation) on the implementation side, but would be hopefully more convenient on user's side.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the levity-polymorphic API described in the linked Data.Bytes.Parser.Rebindable example and identify which parser functions and classes need broader coverage. Define the desired user-facing API and implementation approach before making changes; done means parsers can return directly unboxable types such as Int and Double without the current LiftedRep limitation.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.