0 | module Data.Container.Morphism
2 | import public Data.Container
5 | import Control.Relation
9 | record (=%>) (c1, c2 : Container) where
11 | fwd : c1.req -> c2.req
12 | bwd : (x : c1.req) -> c2.res (fwd x) -> c1.res x
19 | identity = id <| (\_ => id)
22 | (⨾) : a =%> b -> b =%> c -> a =%> c
23 | (⨾) x y = (y.fwd . x.fwd) <| (\z => x.bwd z . y.bwd (x.fwd z))
26 | embed : {0 a : Type} -> {0 b : a -> Type} -> (f : (x : a) -> b x) ->
27 | ((!>) a b) =%> CUnit
28 | embed f = (\_ => ()) <| (\x, _ => f x)
31 | extract : ((!>) a b) =%> CUnit -> (x : a) -> b x
32 | extract c x = c.bwd x ()
35 | unit : CUnit ⊗ CUnit =%> CUnit
48 | Reflexive Container (=%>) where
49 | reflexive = identity
52 | Transitive Container (=%>) where
56 | Preorder Container (=%>) where