0 | module Data.Container.Base.Properties.Definition
2 | import public Decidable.Equality
7 | import Data.Container.Base.Object.Definition
8 | import Data.Container.Base.Morphism.Definition
9 | import Data.Container.Base.Extension.Definition
10 | import Data.Container.Base.Endofunctor.Definition
12 | import Data.Container.Base.Object.Instances
13 | import Data.Container.Base.Morphism.Instances
27 | interface MapToWith (0 i : Type -> Type) (0 c : Cont) (0 d : Cont) where
29 | mapTo : i <!> d =%> c
32 | MapTo : {default id i : Type -> Type} -> Cont -> Cont -> Type
33 | MapTo c d = MapToWith i c d
38 | InterfaceOnPositions : Cont -> (Type -> Type) -> Type
39 | InterfaceOnPositions c i = MapTo {i} Scalar c
42 | MkI : ((s : c.Shp) -> i (c.Pos s)) -> InterfaceOnPositions c i
43 | MkI f = Along (toCostate f)
47 | GetInterface : InterfaceOnPositions c i -> (s : c.Shp) -> i (c.Pos s)
48 | GetInterface _ = fromCostate mapTo
52 | fromPositions : {0 c : Cont} -> {0 i : Type -> Type} ->
53 | (pos : (s : c.Shp) -> i (c.Pos s)) => InterfaceOnPositions c i
54 | fromPositions @{pos} = MkI pos
59 | IsDecidable : Cont -> Type
60 | IsDecidable c = InterfaceOnPositions c DecEq
67 | IsNonEmpty : Cont -> Type
68 | IsNonEmpty c = InterfaceOnPositions c id
72 | ChosenPositions : Cont -> Type
73 | ChosenPositions = IsNonEmpty
81 | data IsA : Cont -> (0 f : a -> Cont) -> Type where
82 | Via : (x : a) -> IsA (f x) f
85 | IsFlat : Cont -> Type
86 | IsFlat c = IsA c Flat
89 | IsSharp : Cont -> Type
90 | IsSharp c = IsA c Sharp
95 | IsConst : Cont -> Type
96 | IsConst c = IsA c Const
100 | IsNaperian : Cont -> Type
101 | IsNaperian c = IsA c Nap
103 | namespace NaperianHelpers
105 | LogHelper : IsNaperian c => Type
106 | LogHelper @{Via pos} = pos
109 | Log : (0 c : Cont) -> IsNaperian c => Type
110 | Log _ @{Via pos} = pos
113 | naperianPosEq : IsNaperian c => {0 x, y : c.Shp} -> c.Pos x = c.Pos y
114 | naperianPosEq @{Via _} = Refl
122 | IsCubical : Cont -> Type
123 | IsCubical c = IsA c Vect
125 | namespace CubicalHelpers
127 | dimHelper : IsCubical c -> Nat
128 | dimHelper (Via n) = n
132 | dim : (0 c : Cont) -> IsCubical c => Nat
133 | dim _ @{ic} = dimHelper ic
137 | isCubicalContEq : IsCubical d -> d = Vect (dim {c=d})
138 | isCubicalContEq (Via n) = Refl
144 | IsFoldable : Cont -> Type
145 | IsFoldable c = MapTo List c
150 | IsSummable : Cont -> Type
151 | IsSummable c = MapTo Bag c
156 | mapToList : IsFoldable c => c =%> List
157 | mapToList @{Along toL} = !% (%! toL)
160 | mapToBag : IsSummable c => c =%> Bag
161 | mapToBag @{Along toB} = !% (%! toB)
169 | interface IsEnumerable (0 c : Cont) where
170 | constructor MkIsEnum
171 | enumerate : c =:> List
173 | namespace IsConcrete
177 | interface IsConcrete (0 c : Cont) where
178 | constructor MkIsConcrete
179 | func : Type -> Type
180 | functorInstance : Functor func
181 | fromConcreteTy : func a -> Ext c a
182 | toConcreteTy : Ext c a -> func a
184 | public export prefix 0 >#
, #>
187 | (>#) : IsConcrete c => func {c=c} a -> Ext c a
188 | (>#) = fromConcreteTy
191 | (#>) : IsConcrete c => Ext c a -> func {c=c} a
192 | (#>) = toConcreteTy