问题
In Control.Arrow.Constrained there is a class WellPointed:
Unlike with Morphism and PreArrow, a literal dual of WellPointed does not seem useful.
Which is true as the duality for the following methods seems a bit weird:
globalElement :: ObjectPoint a x => x -> a (UnitObject a) x
unit :: CatTagged a (UnitObject a)
const :: (Object a b, ObjectPoint a x) => x -> a b x
But why would not we like (for example) having const
for "choice" arrows (like having some constant error information which could be then tagged)? Having unit
in this hierarchy does not seem weird too as we have already started speaking of units in CoCartesian when working with 2 sum-types: Bool ≅ unit + unit
and Maybe a ≅ unit + a
.
So, how do we deal with this? Are we somehow guaranteed to be able to write down all the instances for WellPointed superclasses (and, if it is so, does it have something to do with Arrow
being ArrowChoice
's superclass)? Also, why do we define those methods in PreArrow's subclass? Why could not have we moved them "down" the hierarchy?
Edit: I found this post by leftaroundabout (who is the author of Control.Arrow.Constrained) where he writes WellPointed down as the direct Category
's subclass. Why were things written down another way in Control.Arrow.Constrained?
来源:https://stackoverflow.com/questions/63060108/wellpointed-for-dual-to-prearrow-class