0 | module Data.CT.Functor.Instances
2 | import Data.CT.Category.Definition
3 | import Data.CT.Category.Instances
4 | import Data.CT.Functor.Definition
7 | import Data.Container.Base
8 | import Data.Container.Additive
12 | id = MkFunctor id id
16 | IndCat : (c : Cat) -> Type
17 | IndCat c = Functor c (opCat Cat)
20 | Const : {c : Cat} -> IndCat c
21 | Const = MkFunctor (\_ => c) (\_ => id)
25 | FamObj : {c : Cat} -> (a : Type) -> Cat
26 | FamObj a = MkCat (a -> c.Obj) (\a', b' => (x : a) -> c.Hom (a' x) (b' x))
29 | FamMor : {c : Cat} ->
30 | {0 x, y : Type} -> (x -> y) -> Functor (FamObj {c=c} y) (FamObj {c=c} x)
31 | FamMor f = MkFunctor (. f) (\j, xx => j (f xx))
35 | FamIndCat : {c : Cat} -> IndCat TypeCat
36 | FamIndCat = MkFunctor (\a => FamObj {c=c} a) FamMor
40 | Base : Functor DLens TypeCat
41 | Base = MkFunctor Shp (.fwd)
45 | FamDLens : {c : Cat} -> IndCat DLens
46 | FamDLens = composeFunctors Base (FamIndCat {c=c})
50 | AddBase : Functor AddDLens TypeCat
51 | AddBase = MkFunctor (.Shp) (.fwd)
54 | FamAddDLens : {c : Cat} -> IndCat AddDLens
55 | FamAddDLens = composeFunctors AddBase (FamIndCat {c=c})
61 | IndexedType : Type -> Type
62 | IndexedType a = a -> Type
65 | TypeDPair : {a : Type} -> IndexedType a -> Type
66 | TypeDPair fam = (x : a ** fam x)
69 | TypeDFun : {a : Type} -> IndexedType a -> Type
70 | TypeDFun fam = (x : a) -> fam x
75 | IndexedCont : Cont -> Type
76 | IndexedCont c = c.Shp -> Cont
79 | ContDPair : {a : Cont} -> IndexedCont a -> Cont
80 | ContDPair a' = ((
x ** t)
: DPair a.Shp (Shp . a')) !> (a' x).Pos t
83 | ContProbDPair : {a : Cont} -> IndexedCont a -> Cont
84 | ContProbDPair a' = (((x, d) ** t) : DPair (a.Shp, Double) (Shp . a' . fst)) !>
96 | ContDPairSimple : (c : Cont) -> IndexedCont c -> Cont
97 | ContDPairSimple c fam =
98 | (st : (s : c.Shp ** (fam s).Shp)) !>
99 | (fam (fst st)).Pos (snd st)
112 | ContDFun : (c : Cont) -> IndexedCont c -> Cont
114 | (f : ((s : c.Shp) -> (fam s).Shp)) !>
115 | (s : c.Shp ** (p : c.Pos s ** (fam s).Pos (f s)))
123 | constFam : {c : Cont} -> Cont -> IndexedCont c
124 | constFam d = \_ => d
128 | trivialFam : {c : Cont} -> IndexedCont c
129 | trivialFam = \_ => ((_ : ()) !> Void)
133 | boolFam : {c : Cont} -> IndexedCont c
134 | boolFam = \_ => ((_ : Bool) !> Void)