Skip to content

dependencies of things (vol. 94): Relation.Nullary.Decidable #2059

Closed
@jamesmckinna

Description

@jamesmckinna

Working on PR #2055 drew my attention to the following dependency design 'indecision', probably arising from previous large-scale refactorings:

  • Relation.Nullary.Decidable imports Data.Sum.Base but does not use it at all (anymore) UPDATED this non-dependency now seems to have been fixed
  • Data.Sum imports various ('the usual') things from Relation.Nullary.*, but all/only in the service of defining
-- Conversion back and forth with Dec

fromDec : Dec A  A ⊎ ¬ A
fromDec ( true because  [p]) = inj₁ (invert  [p])
fromDec (false because [¬p]) = inj₂ (invert [¬p])

toDec : A ⊎ ¬ A  Dec A
toDec (inj₁ p)  = yes p
toDec (inj₂ ¬p) = no ¬p

So a question naturally arises (usual asymmetry between which module in a to*/from* scenario takes ownership of the functions) whether

  • (NOCHANGE) Data.Sum should continue to import the relevant pieces of Relation.Nullary.*
  • (CHANGE) else Relation.Nullary.Decidable (NOT or .Core? not sure about the potential dependency cycles here) should continue to import Data.Sum.Base, but also define fromDec and toDec, drastically simplifying the import list for Data.Sum

PROPOSAL: adopt the second 'CHANGE' option, on the basis that Sum is conceptually/computationally prior to Decidable (so should have 'lighter' dependencies), moreover these functions only exercise specialised instances of _⊎_

A followup question would/might then be, cf. #2058 :

  • possible candidate renamings of these functions
fromDec ↦  dec⁻
toDec ↦  dec⁺
  • or else
fromDec ↦  toSum
toDec ↦  fromSum

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions