Skip to content

Conversation

@jacquescomeaux
Copy link
Contributor

@jacquescomeaux jacquescomeaux commented Nov 3, 2025

I was intending to improve typechecking time, but I think I ended up making more progress on the "lines of Haskell compiled to" metric.

The biggest improvements came from moving equational proofs out of records fields and into where blocks, but I also noticed that some of my changes (not sure which) to make the proofs more readable also reduced the size of the Haskell.

So far Categories.Functor.Monoidal.Properties is down from 242362 lines of Haskell to 95295 lines. I'm not quite done updating that file yet. I plan to update Categories.Functor.Monoidal.Construction.Product as part of this PR as well.

I also added opposite braided and symmetric monoidal categorites, and an op field to the bundled forms. This does make accessing the op of the underlying category ever so slightly harder.

I changed the definition of flip-bifunctor for better definitional equality, and added a way to get the oplax structure of a strong monoidal functor.

- Expanded definition of flip-bifunctor (instead of composing with the
  Swap functor) to allow for simpler proofs of the functor laws.
- Added properties for "flipping" natural transformations and natural
  isomorphisms between bifunctors.

This makes flipping twice definitionally involutive.
@jacquescomeaux jacquescomeaux marked this pull request as draft November 3, 2025 23:17
@JacquesCarette
Copy link
Collaborator

Will review 'soon' - first have to fix the broken CI. So there will be a delay.

@JacquesCarette
Copy link
Collaborator

(closing and reopening to get the CI to run)

@jacquescomeaux
Copy link
Contributor Author

Upon further inspection, Categories.Functor.Monoidal.Construction.Product does have equational proofs in record fields, but it doesn't seem particularly offensive in terms of lines of haskell, typechecking time, or readability. So I think I'll leave that one as it is for now, possibly to revisit in a future PR.

@jacquescomeaux jacquescomeaux marked this pull request as ready for review November 20, 2025 00:01
@Taneb
Copy link
Member

Taneb commented Nov 20, 2025

I'm fairly sure that the issue isn't with proofs in record fields (directly), but with proofs used as arguments to functions to construct morphisms (e.g. various limits' universal), because these terms tend to be duplicated many times (for example in subsequent morphism reasoning proofs). Being in a record field isn't enough insulation against this.

@JacquesCarette
Copy link
Collaborator

There are issues with nameless proofs. First, usability: goals become giant. Second, because Agda is fairly eager to delta and eta expand, some record fields do end up duplicated. So more 'modern' agda-categories style tries to minimize proofs inline to record fields.

BTW, I've warmed up to co-patterns, so in some cases, I would be fine using those instead of records, if it feels more ergonomic to do so.

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.

3 participants