Skip to content

exactprint prototype, barbie approach#11690

Draft
leana8959 wants to merge 17 commits into
haskell:masterfrom
leana8959:gpd-barbie
Draft

exactprint prototype, barbie approach#11690
leana8959 wants to merge 17 commits into
haskell:masterfrom
leana8959:gpd-barbie

Conversation

@leana8959
Copy link
Copy Markdown
Collaborator

Please read Github PR Conventions and then fill in one of these two templates.


Template Α: This PR modifies behaviour or interface

Include the following checklist in your PR:


Template B: This PR does not modify behaviour or interface

E.g. the PR only touches documentation or tests, does refactorings, etc.

Include the following checklist in your PR:

  • Patches conform to the coding conventions.
  • Is this a PR that fixes CI? If so, it will need to be backported to older cabal release branches (ask maintainers for directions).

@leana8959 leana8959 force-pushed the gpd-barbie branch 2 times, most recently from 4533c76 to cb2fa93 Compare April 7, 2026 13:31
@leana8959 leana8959 force-pushed the gpd-barbie branch 2 times, most recently from 1853c00 to 16b1779 Compare May 13, 2026 14:03
leana8959 added 4 commits May 13, 2026 16:44
fix build error

don't allow other types as modifiers

stop using undecidable instances

rewrite condtree as barbie

rewrite condbranch as barbie

fix build

add ExactParsec class

simple example for dependency

make PackageName a barbie

fix build

pass down modifier to package name barbie

update Dependency's ExactParsec instance

complete PackageName exactparse proof of concept

use exactparsec to define parsec

parameterize VersionRange

parameterize Version

pass down modifier to version barbie

remove ExactParsec class

Rename Barbie -> With, WithTrivia -> Ann

implement VersionRangeAnn Parsec instance

define Parsec without ann

remodel trivia representation

remodel version range

fix trailing / leading string

implement pretty VersionRangeAnn

use VersionRangeAnn in DependencyAnn

implement pretty DependencyAnn

parameterize BuildInfo

parameterize Library

parameterize GenericPackageDescription

refactor modify

rename type variable for consistency

Modifiers now have kind type

make buildinfo lens polymorphic

update codebase to match HasBuildInfo change

introduce constraint alias

fix compilation

run formatter

implement Ann variant of HasBuildInfoWith class

make buildInfoFieldGrammar generic

make optionsFieldGrammar generic

make profOptionsfieldGrammar generic

make sharedOptionsFieldGrammar generic

make profSharedOptionsFieldGrammar generic

make hsSourceDirsGrammar generic

export GenericPackageDescriptionAnn alias

run formatter

clean up

make library's lens polymorphic

make libraryFieldGrammar polymorphic

add dependency parsec/pretty instance tests

complete dependency roundtrip

refactor cabal versioned tests

test entirety of cabal dependency specification

parameterize newtype combinators

fix compile errors

make testcases names more descriptive

implement trivia-aware commavcat

run fourmolu

fix warnings

implement trivia-aware commafcat

implement trivia-aware vcatann

run fourmolu

implement trivia-aware fsepann

implement trivia-aware NoCommaFSepAnn

only guard ^>= bound test behind cabal version 2

implement parsec instance of trivia-aware polymorphic list combinator

implement pretty instance of trivia-aware list combinator

add all tests for combinators

fix VCatAnn and FSepAnn leading trivia parsing

fix VCatAnn and FSepAnn optional comma

fix CommaVCatAnn and CommaFSepAnn trailing

correct parsec pretty test names

factor out parsecSpaceAnn pattern

include position in trivia model

refactor cabal-syntax to use DataKinds

This makes the modifier closed

fix project wide compilation errors

create PrettPos as subclass of Pretty

add todos

Revert "create PrettPos as subclass of Pretty"

Retrieve stored position from the Pretty instances and pass them to FieldGrammar.

What was tried:
- [x] MultiParamTypeClasses
    Breaking all downstream instances due to instance head change.

- [x] TypeFamilies:
    Impossible to use injectivity because one modifier has more than one `a`.
    Otherwise requires all sites to define the associated type modifier.

- [x] PrettyPos as subclass of Pretty. Use PrettyPos in FieldGrammar.
    Enforces all field grammar to have position. Not all of them have position.

- [ ] Combine MultiParamTypeClasses and PrettyPos subclass:
    Flexibility: not all field grammar need to have the same output type.
    No breakage: downstream instance heads aren't changed. We create a new class.

make trivia type parameterized

In some situations we want to pass around not only the whitespaces
trivia, but also Position. This makes it possible to reuse the Trivia
type for Position.

implement model for position tracking

WIP: figure out how to thread position in field grammar

implement example of build depends with positions

implement pretty version of field grammar

make targetBuildDepends field hold position if needed

field BuildInfo type family

simplify TargetBuildDepends type class

mini example of field grammar with position retention

checkpoint

checkpoint

conversion example

allow contramapping field grammar and leave some notes

attepmt to make position registering also controllable in field grammar

attempt to parameterize field gramamr output

implement field grammar fully generically

Split out Annotate type family

move AttachPos type family

remove TargetBuildDepends type family

rewrite with proxy

introduce one more type argument in Field Grammar

add a field to attepmt polymorphic monoidalFieldAla output

reimplement minibuildinfo with generic monoidalFieldAla'

implement monoidalFieldAla'

export miniBuildInfoFieldGrammar for a demo

implement demo for miniBuildInfoDemo

add note

demonstrate that NoAnn works

implement buildable field in BuildInfo

implement buildable

split AttachPos into AttachPos and PreserveGrouping

implement buildTools

remove some redundant type application

implement BuildtoolDepends

use mod to choose ListWith instance

fix buildinfo example

add cppOptions field

add asmOptions field

add cmmOptions field

inline newtypes with new helpers

test out specialization idea

add ccOptions field

add cxxOptions field

implement jsppOptions

add ldOptions field

add hsc2hsOptions field

add pkgConfigDependency field

stuck at frameworks field

implement framework field

add extraFrameworkDirs field

add asmSources field

add cmmSources field

add cSources field

add cxxSources field

add jsSources field

add hsSourceDirs field

make hsSourceDirs polymorphic /and/ backward compatible

add other modules field

example implementation of printer monoidalFieldAla

attach trivia to boolean

relax pretty field grammar output type

leave some notes

insert real position in cabalparsec and parsecparser

thread through real offsetted position

remodel buildable boolean field annotation

- position can never appear when inserted
- there is no string annotation (we ignore the casing here because
  warning means the cabal file is not valid)

remove random comment

push out fieldname position

run fourmolu

distinguish AttachPositions and AttachPosition

patch pretty for now so it builds and runs most tests fine

test displaying mini build info, add note about model

add parsec combinator to store position

register each element's position in list combinators

fix minibuildinfo

register each field position for hsSourceDirs

make buildinfofieldgrammar' polymorphic again

remove unused prototype methods

leave notes for newtype ListWith

update comments on future direction regarding pretty

include ExactDoc module from trivia tree attempt for full roundtrip

reimplement prettyfield to exactdoc

demonstrate roundtrip in cli

add a small cabal file test

XXX tree-wide change is necessary to parse with current entrypoint

To parse with parseGenericPackageDescription, it is necessary to
use buildInfoFieldGrammar. However, it is not yet fully generic.

Revert "XXX tree-wide change is necessary to parse with current entrypoint"

This reverts commit d3e5d79.

update buildinfofieldgrammar' to compile again

parse all fields of build info

rewire buildinfofieldgrammar

polymorphize libraryFieldGrammar

checkpoint

fully generalize goSection && parseGenericParsecDescription

fix test suite compilation

run parser against hackage

implement smallCabalFile test

implement part of ppGenericPackageDescriptionAnn

did thing

repair boolean field!

Implement position preserving optionalfieldAla'

implement position preserving optionalfieldala' (printer)

preserve cabal-version position

make uniqueField polymorphic

implement parsec

implement pretty

use uniqueField in pkgName

use uniqueField in pkgVersion

filter out zeroPos fields for now

render pretty fields with exactdoc

retain section position

push out section position to pretty field (WIP)

float out position in pretty printer

float out positions from condtrees

inject lens into pretty printer when running

add field to Library to store section position

add lens for the aforementioned field

add method to parser to register section position

change printer to use this lens

rewire the parser to insert the position properly

provide lens in printing functions

make lens' focus polymorphic

rewrite with Maybe for post section position insertion

store section position in condtree library

retrieve section position from sub library

clean up previous experiments

some clean up and prepare smallCabalFile for demo

try hackage roundtrip tests

remove dead code

run fourmolu

refactor modules

rename modifiers

simplify type families

add experimental type aliases

add type alias for ParsecFieldGrammar

add type alias for PrettyFieldGrammar

fix ParsecFG compilation errors

fix some export/import errors

fix test import

mark -any as inserted

test -any and -none

fix hackage tests

add backward compatible method stubs for now

restore TestSuite parsing and validation

restore Benchmark parsing and validation

restore specialization pragma

use MonoidalFieldAla alias

refactor hssourcedirconstraint

use monolocalbind

fix most compilation warnings

clean up constraints

refactor constraints

run fourmolu

restore buildinfofieldgrammar constraints

remove redundant constraints

remove redundant constraints

push out gpd validation, validate only abst syntax

remove redundant constraints

restore validation

restore error message

restore mixins version guard

update golden test files

use compact diff when displaying errors

run fourmolu

clean up and fix test suite compilation
@ulysses4ever ulysses4ever mentioned this pull request May 14, 2026
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant