The main idea of Agda ↔ is to package two functions with two rounding proofs, which is easy enough to do in Idris:
infix 7 ~~ data (~~) : Type -> Type -> Type where MkIso : {A : Type} -> {B : Type} -> (to : A -> B) -> (from : B -> A) -> (fromTo : (x : A) -> from (to x) = x) -> (toFrom : (y : B) -> to (from y) = y) -> A ~~ B
You can use it as in the following minimal example:
notNot : Bool ~~ Bool notNot = MkIso not not prf prf where prf : (x : Bool) -> not (not x) = x prf True = Refl prf False = Refl
The reason why the Agda version is more complicated is because it is parameterized by the choice of equality, so it should not be propositional (which is the strictest / best). Parameterization of the Idris definition ~~ above from = to arbitrary PA : A -> A -> Type and PB : B -> B -> Type left as an exercise for the reader.
source share