15 | ||| The derivative of a container `c` can be thought of as a shape `s : c.Shp`,
16 | ||| a distinguished position `p : c.Pos s`, and the set of *all other positions*
17 | ||| Technically, this is an endofunctor only on cartesian containers
23 | {-------------------------------------------------------------------------------
24 | Distributive laws between endofunctors and other stuff
25 | -------------------------------------------------------------------------------}
31 | ||| Composition product analogue of `joinBw`
32 | ||| On the backward pass, it flattens an `m` of (position, `m` of positions)
33 | ||| pairs into a single `m` of full positions.
53 | ?compositionBang_bwd)
61 | -- public export
62 | -- unplug : IsDecidable c =>
63 | -- Pointed c =%> Scalar >*< Deriv c
64 | -- unplug @{MkI dec} = !% \(s ** p) => (((), (s ** p)) ** \case
65 | -- Left () => p
66 | -- Right (p' ** _) => p')
67 | --
68 | --
69 | -- public export
70 | -- plug : IsDecidable c =>
71 | -- Scalar >*< Deriv c =%> Pointed c
72 | -- plug @{MkI dec} = !% \((), (s ** p)) => ((s ** p) **
73 | -- \p' => case decEq @{dec s} p p' of
74 | -- Yes _ => Left ()
75 | -- No contra => Right (p' ** proofIneqIsNo @{dec s} contra))
78 | ||| Can also be written in terms of unplug and plug
86 | ||| The `index` field of an extension defines a "getter" for a container
87 | ||| This is the container setter