0 | module Data.Container.Additive.Morphism.Definition
2 | import Data.Container.Base
3 | import Data.ComMonoid
4 | import Data.Container.Additive.Object.Definition
10 | public export prefix 0 %!
11 | public export prefix 0 &!
12 | public export prefix 0 !%+
13 | public export prefix 0 !&+
14 | export infixl 5 %+>>
15 | export infixl 5 &+>>
17 | namespace DependentLenses
29 | record (=%+>) (c, d : AddCont) where
31 | ULens : UC c =%> UC d
36 | (!%+) : {0 c, d : AddCont} ->
37 | ((x : c.Shp) -> (y : d.Shp ** (d.Pos y -> c.Pos x))) ->
39 | (!%+) f = (!%) ((!%) f)
42 | (%!+) : {0 c, d : AddCont} ->
43 | c =%+> d -> (x : c.Shp) -> (y : d.Shp ** (d.Pos y -> c.Pos x))
44 | (%!+) (!% f) = (%!) f
47 | (.fwd) : {0 c, d : AddCont} -> c =%+> d -> c.Shp -> d.Shp
48 | (.fwd) f = (ULens f).fwd
51 | (.bwd) : {0 c, d : AddCont} -> (f : c =%+> d) ->
52 | (x : c.Shp) -> d.Pos (f.fwd x) -> c.Pos x
53 | (.bwd) f = (ULens f).bwd
56 | compDepLens : {0 c, d, e : AddCont} -> c =%+> d -> d =%+> e -> c =%+> e
57 | compDepLens f g = (!%) (compDepLens (ULens f) (ULens g))
60 | (%+>>) : {0 c, d, e : AddCont} -> c =%+> d -> d =%+> e -> c =%+> e
61 | (%+>>) = compDepLens
64 | id : {0 c : AddCont} -> c =%+> c
75 | lensInputs : {c, d : AddCont} -> c =%+> d -> AddCont
76 | lensInputs lens = MkAddCont
77 | (lensInputs (ULens lens))
78 | {mon=(MkI $
\s => UMon d (lens.fwd s))}
81 | namespace DependentCharts
92 | record (=&+>) (c, d : AddCont) where
94 | UChart : UC c =&> UC d
97 | (!&+) : {0 c, d : AddCont} ->
98 | ((x : c.Shp) -> (y : d.Shp ** (c.Pos x -> d.Pos y))) ->
100 | (!&+) f = (!&) ((!&) f)
103 | (&!+) : {0 c, d : AddCont} -> c =&+> d -> (x : c.Shp) -> (y : d.Shp ** (c.Pos x -> d.Pos y))
104 | (&!+) (!& f) = (&!) f
107 | (.fwd) : {0 c, d : AddCont} -> c =&+> d -> c.Shp -> d.Shp
108 | (.fwd) f = (UChart f).fwd
111 | (.bwd) : {0 c, d : AddCont} -> (f : c =&+> d) ->
112 | (x : c.Shp) -> c.Pos x -> d.Pos (f.fwd x)
113 | (.bwd) f = (UChart f).bwd
116 | compDepChart : {0 c, d, e : AddCont} -> c =&+> d -> d =&+> e -> c =&+> e
117 | compDepChart f g = (!&) (compDepChart (UChart f) (UChart g))
120 | (&+>>) : {0 c, d, e : AddCont} -> c =&+> d -> d =&+> e -> c =&+> e
121 | (&+>>) = compDepChart
124 | id : {0 c : AddCont} -> c =&+> c
130 | chartInputs : {c, d : AddCont} -> (0 f : c =&+> d) -> AddCont