0 | module Pipeline.Category
 1 |
 2 | import public Control.Category
 3 | import public Data.Vect.Erased
 4 |
 5 |
 6 | -- Pipelines parameterised over a category we first declare the objects and arrows of the category
 7 | parameters {0 obj : Type} {0 arr : obj -> obj -> Type}
 8 |
 9 |   -- An implementation is a list of paired-up morphisms
10 |   public export 0
11 |   ImplCat : Vect0 (2 + n) obj -> Type
12 |   ImplCat xs = All0 (uncurry arr) (Erased.pairUp xs)
13 |
14 |
15 |   -- Running the pipeline requires evidence that the morphisms form a category and an implementation
16 |   -- for each morphism
17 |   export
18 |   RunCat : {auto cat : Category {obj} arr} -> (p : Vect0 (2 + n) obj) -> ImplCat p -> Head p `arr` Last p
19 |   RunCat [x, y] [f] = f
20 |   RunCat (x :: y :: z :: xs) (f :: c) = RunCat (y :: z :: xs) c . f
21 |
22 |