summaryrefslogtreecommitdiff
path: root/src/SOAS/Strength.idr
diff options
context:
space:
mode:
authorGreg Brown <greg.brown01@ed.ac.uk>2024-02-01 19:25:13 +0000
committerGreg Brown <greg.brown01@ed.ac.uk>2024-02-02 13:33:09 +0000
commit4b9b6b0211f6fb5691d67ca77ac09be888e569b7 (patch)
tree33451a63c169a06d0fee67393d0bf081f7e0b1e3 /src/SOAS/Strength.idr
parentfa4de437fa3861189b506538f6ca4a39771ecbbb (diff)
Define generic syntax construction.main
Whilst it works (see `Example`), a generated data type would probably work better.
Diffstat (limited to 'src/SOAS/Strength.idr')
-rw-r--r--src/SOAS/Strength.idr29
1 files changed, 18 insertions, 11 deletions
diff --git a/src/SOAS/Strength.idr b/src/SOAS/Strength.idr
index f902ad4..2174baf 100644
--- a/src/SOAS/Strength.idr
+++ b/src/SOAS/Strength.idr
@@ -1,5 +1,6 @@
module SOAS.Strength
+import SOAS.Context
import SOAS.Family
import SOAS.Structure
import SOAS.Var
@@ -12,22 +13,28 @@ type.SortedFunctor = type.SortedFamily -> type.SortedFamily
public export
record Strength (f : type.SortedFunctor) where
constructor MkStrength
- strength :
- (0 p,x : type.SortedFamily) ->
- (mon : type.PointedCoalgStruct p) ->
+ str :
+ {0 p,x : type.SortedFamily} ->
+ (mon : type.PointedCoalgStruct p) =>
(f (x ^ p)) -|> ((f x) ^ p)
-export
-(.str) :
- Strength f ->
- {0 p,x : type.SortedFamily} ->
- (mon : type.PointedCoalgStruct p) =>
- (f (x ^ p)) -|> ((f x) ^ p)
-strength.str {p,x,mon} = strength.strength p x mon
-
public export
record (.Map) (signature : type.SortedFunctor) where
constructor MkMap
map :
{0 a,b : type.SortedFamily} -> (a -|> b) ->
signature a -|> signature b
+
+public export
+bind : (tys : type.Ctx) -> type.SortedFunctor
+bind tys = (<<< tys)
+
+public export
+record BindRename (tys : type.Ctx) (a : type.SortedFamily) (ty : type) (ctx : type.Ctx) where
+ constructor Bind
+ 0 names : tys.All (\_,_ => String)
+ body : a ty (ctx ++ tys.rename names)
+
+public export
+Nil : a -|> BindRename [<] a
+[] x = Bind [<] x