mirror of
https://github.com/github/semantic.git
synced 2024-12-23 06:41:45 +03:00
Add a Switch case to zipUnwrap
This commit is contained in:
parent
0c1d749f32
commit
af8e7a4d81
@ -33,6 +33,9 @@ zipTerms t1 t2 = annotate (zipUnwrap a b)
|
|||||||
zipUnwrap (Case eA' bodyA') (Case eB' bodyB') = case (zipTerms eA' eB', zipTerms bodyA' bodyB') of
|
zipUnwrap (Case eA' bodyA') (Case eB' bodyB') = case (zipTerms eA' eB', zipTerms bodyA' bodyB') of
|
||||||
(Just id', Just body') -> Just $ Case id' body'
|
(Just id', Just body') -> Just $ Case id' body'
|
||||||
_ -> Nothing
|
_ -> Nothing
|
||||||
|
zipUnwrap (Switch a' as') (Switch b' bs') = case (zipTerms a' b') of
|
||||||
|
(Just expr') -> Just $ Switch expr' (catMaybes $ zipWith zipTerms as' bs')
|
||||||
|
_ -> Nothing
|
||||||
zipUnwrap (Fixed a') (Fixed b') = Just . Fixed . catMaybes $ zipWith zipTerms a' b'
|
zipUnwrap (Fixed a') (Fixed b') = Just . Fixed . catMaybes $ zipWith zipTerms a' b'
|
||||||
zipUnwrap (Keyed a') (Keyed b') | keys a' == keys b' = Just . Keyed . fromList . catMaybes $ zipUnwrapMaps a' b' <$> keys a'
|
zipUnwrap (Keyed a') (Keyed b') | keys a' == keys b' = Just . Keyed . fromList . catMaybes $ zipUnwrapMaps a' b' <$> keys a'
|
||||||
zipUnwrap _ _ = Nothing
|
zipUnwrap _ _ = Nothing
|
||||||
|
Loading…
Reference in New Issue
Block a user