summaryrefslogtreecommitdiff
path: root/src/Data
diff options
context:
space:
mode:
authorGreg Brown <greg.brown01@ed.ac.uk>2022-11-29 14:37:16 +0000
committerGreg Brown <greg.brown01@ed.ac.uk>2022-11-29 14:37:16 +0000
commitd6a3893ac4c77accc497b51eb47597744e1a1c84 (patch)
treedca1433dafc3cfec4750515d0237bbe6d3bfcad1 /src/Data
parentb21e69503571272a5f35cf84c731994f3e921a3a (diff)
Add conversions between indexed setoids.
Diffstat (limited to 'src/Data')
-rw-r--r--src/Data/Setoid/Indexed.idr8
1 files changed, 8 insertions, 0 deletions
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
@@ -32,5 +32,13 @@ record ISetoid (a : Type) where
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)