Closed
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.Decidable
importsData.Sum.Base
but does not use it at all (anymore)Data.Sum
imports 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 ¬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 ofRelation.Nullary.*
- (CHANGE) else
Relation.Nullary.Decidable
(NOTor.Core
? not sure about the potential dependency cycles here) shouldcontinue toimportData.Sum.Base
, but also definefromDec
andtoDec
, 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