mirror of
https://github.com/github/semantic.git
synced 2024-12-19 12:51:52 +03:00
🔥 the hand-rolled alignSyntax' function.
This commit is contained in:
parent
ee260949ea
commit
a9577a2037
@ -42,11 +42,3 @@ alignCofreeWith contrast terms = fromMaybe (pure terms) $ case terms of
|
||||
These t1 t2 -> let (a1 :< s1, a2 :< s2) = (runCofree t1, runCofree t2) in
|
||||
wrap . (These a1 a2 :<) . fmap (alignCofreeWith contrast) <$> contrast s1 s2
|
||||
_ -> Nothing
|
||||
|
||||
alignSyntax' :: Syntax leaf a1 -> Syntax leaf a2 -> Maybe (Syntax leaf (These a1 a2))
|
||||
alignSyntax' a b = case (a, b) of
|
||||
(Leaf _, Leaf s2) -> Just (Leaf s2)
|
||||
(Indexed a, Indexed b) -> Just (Indexed (align a b))
|
||||
(Fixed a, Fixed b) -> Just (Fixed (align a b))
|
||||
(Keyed a, Keyed b) -> Just (Keyed (align a b))
|
||||
_ -> Nothing
|
||||
|
Loading…
Reference in New Issue
Block a user