summaryrefslogtreecommitdiff
path: root/src/Core/Thinning.idr
diff options
context:
space:
mode:
Diffstat (limited to 'src/Core/Thinning.idr')
-rw-r--r--src/Core/Thinning.idr15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/Core/Thinning.idr b/src/Core/Thinning.idr
index dc4efcb..a2500e9 100644
--- a/src/Core/Thinning.idr
+++ b/src/Core/Thinning.idr
@@ -68,3 +68,18 @@ export
wkn : Fin m -> m `Thins` n -> Fin n
wkn i IsId = i
wkn i (IsThinner thin) = wkn' i thin
+
+-- Composition -----------------------------------------------------------------
+
+comp : Thinner m n -> Thinner k m -> Thinner k n
+comp IsBase thin2 = IsDrop thin2
+comp (IsDrop thin1) thin2 = IsDrop (comp thin1 thin2)
+comp (IsKeep thin1) IsBase = IsDrop thin1
+comp (IsKeep thin1) (IsDrop thin2) = IsDrop (comp thin1 thin2)
+comp (IsKeep thin1) (IsKeep thin2) = IsKeep (comp thin1 thin2)
+
+export
+(.) : m `Thins` n -> k `Thins` m -> k `Thins` n
+IsId . thin2 = thin2
+IsThinner thin1 . IsId = IsThinner thin1
+IsThinner thin1 . IsThinner thin2 = IsThinner (comp thin1 thin2)