Hello there. I was doing some stuff with decidable equality and ended up needed the following operations:
imap : β {β} {a b : Set β} β (a β b) β (b β a) β Dec a β Dec b
imap f _ (yes x) = yes (f x)
imap _ g (no x) = no $ x β g
zip : β {β} {a b : Set β} β Dec a β Dec b β Dec (a Γ b)
zip (yes x) (yes y) = yes $ (x , y)
zip (no x) _ = no $ Ξ» { (x' , _) β x x' }
zip _ (no y) = no $ Ξ» { (_ , y') β y y' }
_βͺ_ : β {β} {a b : Set β} β Dec a β Dec b β Dec (a β b)
_βͺ_ (yes a) _ = yes (injβ a)
_βͺ_ (no a) b = imap injβ ([ β₯-elim β a , id ]β²) b
Does it make any sense to add these to the Relation.Nullary module that Dec is exported from?
zip and _βͺ_ respectively have the following units, but doesn't seem to be much of a use for exporting these given that they're very thin aliases for stuff that's already exported under other names:
pure : β {β} {a : Set β} β a β Dec a
pure = yes
β
: Dec β₯
β
= no β₯-elim
Doii, should have looked around more. Thanks
No bother. I myself find it annoying that you have to import 3 or 4 modules to
start working with Dec. I wonder whether we could reorganise this part of the
hierarchy in a backwards-compatible manner that would allow you to import, say
Relation.Decidability and have immediately access to a whole host of functions.
Edit: I have hijacked this issue to discuss such a change.
I am definitely a big fan of having the "developer's library" be made of tons of small files with carefully crafted minimal dependencies, and a "user's library" with fewer modules that provide 'broad utility' with few imports. Both would be part of the standard library.
Most helpful comment
No bother. I myself find it annoying that you have to import 3 or 4 modules to
start working with
Dec. I wonder whether we could reorganise this part of thehierarchy in a backwards-compatible manner that would allow you to import, say
Relation.Decidabilityand have immediately access to a whole host of functions.Edit: I have hijacked this issue to discuss such a change.