0 | module Data.Container.Base.Endofunctor.Definition
2 | import Data.List.Quantifiers
3 | import public Decidable.Equality
5 | import Data.Container.Base.Object.Definition
6 | import Data.Container.Base.Morphism.Definition
8 | import Data.ComMonoid
20 | public export infixr 9 <!>
21 | public export prefix 9 !!
22 | public export prefix 9 !*
26 | (<!>) : (f : Type -> Type) -> Cont -> Cont
27 | f <!> c = (s : c.Shp) !> f (c.Pos s)
31 | (<!>) : (f : Type -> Type) -> Functor f =>
34 | f <!> l = !% \x => let (
y ** ky)
= (%!) l x
51 | (!!) : c =%> d -> !! c =%> !! d
55 | (!*) : c =%> d -> !* c =%> !* d
63 | pureBw : Monad m => m <!> c =%> c
64 | pureBw = !% \x => (
x ** pure)
67 | joinBw : Monad m => m <!> c =%> m <!> (m <!> c)
68 | joinBw = !% \x => (
x ** join)
73 | namespace FunctorsOnCont
75 | ListAll : Cont -> Cont
76 | ListAll c = (ss : List c.Shp) !> All c.Pos ss
79 | ListAny : Cont -> Cont
80 | ListAny c = (ss : List c.Shp) !> Any c.Pos ss
83 | BagAll : Cont -> Cont
84 | BagAll c = (ss : Bag c.Shp) !> All c.Pos ss
87 | unitBag : c =%> BagAll c
88 | unitBag = !% \x => (
MkBag [x] ** qq)
89 | where qq : List.Quantifiers.All.All (c .Pos) [x] -> c .Pos x
94 | bww : (f : c =%> d) -> (cs : List c.Shp) ->
95 | All (d.Pos) (f.fwd <$> cs) -> All (c .Pos) cs
97 | bww f (c :: cs) (a :: as) = (f.bwd c a) :: bww f cs as
100 | List : c =%> d -> ListAll c =%> ListAll d
101 | List f = !% \cs => (
f.fwd <$> cs ** bww f cs)
107 | Pointed : Cont -> Cont
108 | Pointed c = (dp : DPair c) !> c.Pos (fst dp)