Skip to content

[ refactor / design ] primitive operations on Data.Rational which get used in anger as computations #2946

@jamesmckinna

Description

@jamesmckinna

I'm definitely perturbed by

  • p ≤ᵇ 0ℚ in the definition of truncate, when strictly-less-than would make more sense (because/and avoid needless fumbling at 0ℚ...)
  • the lack of sharing between truncate and fracPart in definitions where both operations are deployed, as here

Such concerns are, strictly speaking, out of scope for this PR, but I think we should bear them in mind when implementing (internal) computations intended to be used 'in anger', such as show functions...?

Originally posted by @jamesmckinna in #2945 (comment)

I reasoned as follows:

  • working constructively, it has never made sense to me to work with weaker observations, when stronger/more positive would be 'better': but here, we don't have (the obviously analogous) definition of p <ᵇ 0ℚ... so perhaps we should!?
  • fracPart uses truncate, so as with analogous operations such as division-with-remainder [ add ] a 'better' division with remainder for Data.Integer.Base #2878 , it might make sense to bundle them as a pair, and then project?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions