From d6a3893ac4c77accc497b51eb47597744e1a1c84 Mon Sep 17 00:00:00 2001 From: Greg Brown Date: Tue, 29 Nov 2022 14:37:16 +0000 Subject: Add conversions between indexed setoids. --- src/Data/Setoid/Indexed.idr | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/Data/Setoid/Indexed.idr b/src/Data/Setoid/Indexed.idr index df5606d..7277932 100644 --- a/src/Data/Setoid/Indexed.idr +++ b/src/Data/Setoid/Indexed.idr @@ -31,6 +31,14 @@ record ISetoid (a : Type) where 0 relation : IRel U equivalence : IEquivalence U relation +public export +fromIndexed : (a -> Setoid) -> ISetoid a +fromIndexed x = MkISetoid (\i => (x i).U) (\i => (x i).relation) (\i => (x i).equivalence) + +public export +(.index) : ISetoid a -> a -> Setoid +(.index) x i = MkSetoid (x.U i) (x.relation i) (x.equivalence i) + public export isetoid : (a -> Type) -> ISetoid a isetoid u = MkISetoid u (\_ => Equal) (\_ => equiv) -- cgit v1.2.3