
I wrote (and found useful) the following arrow transformer: data Partial ar a b = Partial (ErrorArrow () ar a b) | Total (ar a b) toPartial :: ArrowChoice ar => Partial ar a b -> ErrorArrow () ar a b toPartial (Partial f) = f toPartial (Total sf) = liftError sf instance ArrowChoice ar => Category (Partial ar) where id = Total id Total f . Total g = Total $ f . g f . g = Partial $ toPartial f . toPartial g instance ArrowChoice ar => Arrow (Partial ar) where arr = Total . arr first (Total f) = Total $ first f first (Partial f) = Partial $ first f It allows to work with partial functions/arrows and at the same time tracks which of them are actually total. I wonder if it is already defined somewhere or is perhaps an instance of a more general construction. Roman