Skip to content

Should the constructors of Data.Nat._≤_ be declared as instances? #1951

Closed
@jamesmckinna

Description

@jamesmckinna

issue #1919 and its associated PR #1948 had got me thinking again about the basic ordering relation(s) on Nat, as well as a side remark of @Taneb 's about having proofs of m ≤ n "floating around" in the context of #1949 ...

Specifically, _≤_ (and hence everything else provably equivalent to it) is an Irrelevant relation, moreover with disjoint constructors z≤n and s≤s. So it seems, at first blush, that we could replace ostensibly informative assumptions/proofs of m ≤ n by instances... or can we?

Cons: huge knock-on viscosity, for starters; but are there also uses where we couldn't easily/reliably delegate to instance inference during typechecking (hello: transitivity!)?

Pros: not sure! It feels like an itch similar to @MatthewDaggitt 's about {{NonZero n}}: it involves non-trivial re-engineering, but still is/might be an itch worth scratching? UPDATED: it would/might/should also permit a smoother approach to defining functions which have m ≤ n preconditions?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions