mirror of
https://github.com/github/semantic.git
synced 2024-12-29 18:06:14 +03:00
Spacing.
This commit is contained in:
parent
12f6ce9fa4
commit
d169e6fa66
@ -43,6 +43,7 @@ spec = parallel $ do
|
||||
it "produces unbiased insertions within branches" $
|
||||
let (a, b) = (decorate (cofree ((StringLiteral .: RNil) :< Indexed [ cofree ((StringLiteral .: RNil) :< Leaf "a") ])), decorate (cofree ((StringLiteral .: RNil) :< Indexed [ cofree ((StringLiteral .: RNil) :< Leaf "b") ]))) in
|
||||
fmap stripDiff (rws compare [ b ] [ a, b ]) `shouldBe` fmap stripDiff [ inserting a, copying b ]
|
||||
|
||||
where compare :: (HasField fields Category, Functor f, Eq (Cofree f Category)) => Cofree f (Record fields) -> Cofree f (Record fields) -> Maybe (Free (CofreeF f (Both (Record fields))) (Patch (Cofree f (Record fields))))
|
||||
compare a b | (category <$> a) == (category <$> b) = Just (copying b)
|
||||
| otherwise = if ((==) `on` category . extract) a b then Just (replacing a b) else Nothing
|
||||
|
Loading…
Reference in New Issue
Block a user