-- | @(b ∘ a)(d) = a(b(d))@ where /a/ and /b/ are two consecutive operations
-- and /d/ is the initial document.
prop_apply_functorial
  :: TestableOTSystem doc op
  => DocHistory doc op Two
  -> Result
prop_apply_functorial (SS doc a (SS _ b (LS _))) =
  eitherResult (apply a doc) $ \doc' ->
  eitherResult (apply b doc') $ \doc''1 ->
  eitherResult (compose a b) $ \ab ->
  eitherResult (apply ab doc) $ \doc''2 ->
  doc''1 ==? doc''2


prop_apply_functorial
  :: TestableOTSystem doc op
  => DocHistory doc op Two
  -> Result
prop_apply_functorial (SS doc a (SS _ b (LS _))) =
  eitherResult (apply a doc) $ \doc' ->
  eitherResult (apply b doc') $ \doc''1 ->
  eitherResult (compose a b) $ \ab ->
  eitherResult (apply ab doc) $ \doc''2 ->
  doc''1 ==? doc''2
prop_apply_functorial (SS doc a (SS _ b (LS _))) =
  eitherResult (apply a doc) $ \doc' ->
  eitherResult (apply b doc') $ \doc''1 ->
  eitherResult (compose a b) $ \ab ->
  eitherResult (apply ab doc) $ \doc''2 ->
  doc''1 ==? doc''2