I'm still trying to understand the intuition of failures (from category theory), limitations, and universal properties, and I don’t quite understand their usefulness, so maybe you could help shed some insight into this, as well as confirming my trivial example?
The following is intentionally verbose, the rollback should be (p, p1, p2) , and (q, q1, q2) is one example of a non-universal object for “checking” rollbacks to check if things are moving correctly.
-- MY DIAGRAM, A -> B <- C type A = Int type C = Bool type B = (A, C) f :: A -> B fx = (x, True) g :: C -> B gx = (1, x) -- PULLBACK, (p, p1, p2) type PL = Int type PR = Bool type P = (PL, PR) p = (1, True) :: P p1 = fst p2 = snd -- (g . p2) p == (f . p1) p -- TEST CASE type QL = Int type QR = Bool type Q = (QL, QR) q = (152, False) :: Q q1 :: Q -> A q1 = ((+) 1) . fst q2 :: Q -> C q2 = ((||) True) . snd u :: Q -> P u (_, _) = (1, True) -- (p2 . u == q2) && (p1 . u = q1)
I was just trying to come up with an example that fits the definition, but it doesn't seem particularly useful. When will I “look for” a rollback or use it?
haskell category-theory
Josh.f
source share