Skip to content

Modernise Data.Vec(.Properties) #1673

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jan 9, 2022
Merged

Conversation

MatthewDaggitt
Copy link
Contributor

@MatthewDaggitt MatthewDaggitt commented Jan 1, 2022

While working on #1668 with @jamesmckinna I noticed that some of the code in Data.Vec(.Properties) is pretty ancient by the library standards. I've tried to modernise the code by:

  • introducing variables for sizes/elements/vectors as now allowed by the style guide
  • importing Relation.Binary.PropositionalEquality unqualified
  • using new combinators in propositional reasoning
  • reorganising the file slightly to match the layout of Base

Should be a very nearly a no-op, modulo the movement of a couple of implicit arguments due to variables, a breakage which is acceptable in v2.0 I think.

@MatthewDaggitt MatthewDaggitt added this to the v2.0 milestone Jan 1, 2022
@MatthewDaggitt MatthewDaggitt changed the title Modernise Data.Vec.Properties Modernise Data.Vec(.Properties) Jan 1, 2022
@jamesmckinna
Copy link
Contributor

jamesmckinna commented Jan 3, 2022

What is the corresponding situation ('modernised', or otherwise) for Data.List?
Is it ('simply'?) the case that this latter (set of) module(s) get(s) much more attention than that/those for Data.Vec?

Comment on lines 531 to 532
zipWith-comm : ∀ (comm : ∀ x y → f x y ≡ f y x) (xs ys : Vec A n) →
zipWith f xs ys ≡ zipWith f ys xs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's kind of strange to be insisting on f being commutative as opposed to
the more general constraint ∀ x y → f x y ≡ g y x.

Copy link
Contributor Author

@MatthewDaggitt MatthewDaggitt Jan 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generalised. At the time I was trying to lift algebraic structures over vectors, so I wasn't thinking in more general terms.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. I guess now that we're not insisting on commutativity, we can also relax the type and have:

f : A  B  C
g : B  A  C

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generalised further!

@MatthewDaggitt
Copy link
Contributor Author

What is the corresponding situation ('modernised', or otherwise) for Data.List?
Is it ('simply'?) the case that this latter (set of) module(s) get(s) much more attention than that/those for Data.Vec?

Better, as they do get more attention. You could definitely go through Data.List.Properties and add variables for x y xs ys though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants