0 | module Data.Container.Additive.Morphism.Definition
2 | import Data.Container.Base
3 | import Data.ComMonoid
4 | import Data.Container.Additive.Object.Definition
11 | public export prefix 0 %!
12 | public export prefix 0 &!
13 | public export prefix 0 :!
14 | public export prefix 0 !%+
15 | public export prefix 0 !&+
16 | export infixl 5 %+>>
17 | export infixl 5 &+>>
19 | namespace DependentLenses
31 | record (=%+>) (c, d : AddCont) where
33 | ULens : UC c =%> UC d
38 | (!%+) : {0 c, d : AddCont} ->
39 | ((x : c.Shp) -> (y : d.Shp ** (d.Pos y -> c.Pos x))) ->
41 | (!%+) f = (!%) ((!%) f)
44 | (%!+) : {0 c, d : AddCont} ->
45 | c =%+> d -> (x : c.Shp) -> (y : d.Shp ** (d.Pos y -> c.Pos x))
46 | (%!+) (!% f) = (%!) f
49 | (.fwd) : {0 c, d : AddCont} -> c =%+> d -> c.Shp -> d.Shp
50 | (.fwd) f = (ULens f).fwd
53 | (.bwd) : {0 c, d : AddCont} -> (f : c =%+> d) ->
54 | (x : c.Shp) -> d.Pos (f.fwd x) -> c.Pos x
55 | (.bwd) f = (ULens f).bwd
58 | compDepLens : {0 c, d, e : AddCont} -> c =%+> d -> d =%+> e -> c =%+> e
59 | compDepLens f g = (!%) (compDepLens (ULens f) (ULens g))
62 | (%+>>) : {0 c, d, e : AddCont} -> c =%+> d -> d =%+> e -> c =%+> e
63 | (%+>>) = compDepLens
66 | id : {0 c : AddCont} -> c =%+> c
78 | lensInputs : {c, d : AddCont} -> c =%+> d -> AddCont
79 | lensInputs lens = MkAddCont
80 | (lensInputs (ULens lens))
81 | {mon=(MkI $
\s => UMon d (lens.fwd s))}
84 | namespace DependentCharts
95 | record (=&+>) (c, d : AddCont) where
97 | UChart : UC c =&> UC d
100 | (!&+) : {0 c, d : AddCont} -> c =&+> d -> (x : c.Shp) -> (y : d.Shp ** (c.Pos x -> d.Pos y))
101 | (!&+) (!& f) = (&!) f
104 | (&!) : {0 c, d : AddCont} -> c =&+> d -> (x : c.Shp) -> (y : d.Shp ** (c.Pos x -> d.Pos y))
105 | (&!) (!& f) = (&!) f
108 | (.fwd) : {0 c, d : AddCont} -> c =&+> d -> c.Shp -> d.Shp
109 | (.fwd) f = (UChart f).fwd
112 | (.bwd) : {0 c, d : AddCont} -> (f : c =&+> d) ->
113 | (x : c.Shp) -> c.Pos x -> d.Pos (f.fwd x)
114 | (.bwd) f = (UChart f).bwd
117 | compDepChart : {0 c, d, e : AddCont} -> c =&+> d -> d =&+> e -> c =&+> e
118 | compDepChart f g = (!&) (compDepChart (UChart f) (UChart g))
121 | (&>>) : {0 c, d, e : AddCont} -> c =&+> d -> d =&+> e -> c =&+> e
122 | (&>>) = compDepChart
125 | id : {0 c : AddCont} -> c =&+> c
131 | chartInputs : {c, d : AddCont} -> (0 f : c =&+> d) -> AddCont