reflex-frp/patch

Should we have a class for diffing?

endgame opened this issue · 0 comments

From a discussion with a colleague, the following class emerged:

-- | Law: applyAlways (diff x y) x = y
class Patch p => Diff p where
  -- | @diff from to@ returns a patch which turns @from@ into @to@.
  diff :: PatchTarget p -> PatchTarget p -> p

It seems useful, even if we cannot guarantee that such a class exists for every patch type.