Skip to content

Flipped type signatures in comments #1825

Open

Description

@MatthiasHu

When reexporting things, there are sometimes type signatures stated in comments. I think I found a few places where these type signatures are inaccurate, for example:

; x≤y⊔x to m≤n⊔m -- : ∀ m n → m ≤ n ⊔ m

This function actually takes the n argument first and the m argument second, because x≤y⊔x is a renaming of x⊓y≤y which of course takes the x argument first:

x⊓y≤y : ∀ x y → x ⊓ y ≤ y

The same issue is present in all four places where x≤y⊔x is re-exported:

src/Data/Integer/Properties.agda:  ; x≤y⊔x     to i≤j⊔i        -- : ∀ i j → i ≤ j ⊔ i
src/Data/Nat/Properties.agda:  ; x≤y⊔x     to m≤n⊔m        -- : ∀ m n → m ≤ n ⊔ m
src/Data/Rational/Properties.agda:  ; x≤y⊔x     to p≤q⊔p        -- : ∀ p q → p ≤ q ⊔ p
src/Data/Rational/Unnormalised/Properties.agda:  ; x≤y⊔x      to p≤q⊔p          -- : ∀ p q → p ≤ q ⊔ p

The same thing happens for example for x≤y⇒x≤z⊔y (which is a renaming of x≤y⇒z⊓x≤y), but here only the order of the implicit arguments is flipped:

src/Data/Integer/Properties.agda:  ; x≤y⇒x≤z⊔y to i≤j⇒i≤k⊔j    -- : ∀ {i j} k → i ≤ j → i ≤ k ⊔ j
src/Data/Nat/Properties.agda:  ; x≤y⇒x≤z⊔y to m≤n⇒m≤o⊔n    -- : ∀ {m n} o → m ≤ n → m ≤ o ⊔ n
src/Data/Rational/Properties.agda:  ; x≤y⇒x≤z⊔y to p≤q⇒p≤r⊔q    -- : ∀ {p q} r → p ≤ q → p ≤ r ⊔ q
src/Data/Rational/Unnormalised/Properties.agda:  ; x≤y⇒x≤z⊔y  to p≤q⇒p≤r⊔q      -- : ∀ {p q} r → p ≤ q → p ≤ r ⊔ q

Activity

  1. MatthewDaggitt commented on Sep 20, 2022

    @MatthewDaggitt
    Collaborator

    Thank you, nice spot! Wish these weren't necessary and we had editor support...

  2. added this to the v2.0 milestone on Sep 20, 2022
  3. MatthiasHu commented on Sep 20, 2022

    @MatthiasHu
    Author

    I wonder if it could be best here to change the actual type signatures of x≤y⊔x and x≤y⇒x≤z⊔y (and similar cases) to reflect the order in which the variables x, y, z appear in the name.

  4. JacquesCarette commented on Sep 29, 2022

    @JacquesCarette
    Collaborator

    In your "I wonder", do you mean that the rename

      ; x⊓y≤y      to x≤y⊔x

    should instead be

      ; x⊓y≤y      to y≤x⊔y

    ?

  5. MatthiasHu commented on Sep 29, 2022

    @MatthiasHu
    Author

    No, I meant that there should be this:

    x≤y⊔x : ∀ x y → x ≤ y ⊔ x

    This can not be achieved by a renaming-reexport of x⊓y≤y, one would need a separate definition to flip the arguments.

  6. Saransh-cpp commented on Aug 19, 2023

    @Saransh-cpp
    Contributor

    Also, n≤m⊔n was deprecated and m≤n⊔m was introduced -

    n≤m⊔n = m≤n⊔m
    {-# WARNING_ON_USAGE n≤m⊔n
    "Warning: n≤m⊔n was deprecated in v1.6. Please use m≤n⊔m instead."
    #-}

    Should I just update the type signature in the comments?

  7. modified the milestones: v2.0, v2.1 on Oct 16, 2023
  8. jamesmckinna commented on Jun 6, 2024

    @jamesmckinna
    Collaborator

    We bumped this from v2.0 to v2.1... suggest we do so again to v2.2 unless someone feels like tackling this before the end of June?

  9. modified the milestones: v2.1, v2.2 on Jun 7, 2024
  10. modified the milestones: v2.2, v3.0 on Jan 2, 2025
  11. jamesmckinna commented on Jul 9, 2026

    @jamesmckinna
    Collaborator

    And we should solve this together with any solution to #1664 ?

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions