-
Notifications
You must be signed in to change notification settings - Fork 259
Closed
Milestone
Description
Working on PR #2055 drew my attention to the following dependency design 'indecision', probably arising from previous large-scale refactorings:
UPDATED this non-dependency now seems to have been fixedRelation.Nullary.DecidableimportsData.Sum.Basebut does not use it at all (anymore)Data.Sumimports various ('the usual') things fromRelation.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 ¬pSo a question naturally arises (usual asymmetry between which module in a to*/from* scenario takes ownership of the functions) whether
- (NOCHANGE)
Data.Sumshould continue to import the relevant pieces ofRelation.Nullary.* - (CHANGE) else
Relation.Nullary.Decidable(NOTor.Core? not sure about the potential dependency cycles here) shouldcontinue toimportData.Sum.Base, but also definefromDecandtoDec, drastically simplifying the import list forData.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