1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 06:11:49 +03:00

Use the getters instead of destructuring.

This commit is contained in:
Rob Rix 2016-07-11 14:03:54 -04:00
parent 26757185d9
commit 42f18e9b4f

View File

@ -39,6 +39,5 @@ termSize = cata size where
alignCofreeWith :: Functor f => (forall a b. f a -> f b -> Maybe (f (These a b))) -> (a -> b -> c) -> These (Cofree f a) (Cofree f b) -> Free (CofreeF f c) (These (Cofree f a) (Cofree f b))
alignCofreeWith contrast combine = go
where go terms = fromMaybe (pure terms) $ case terms of
These t1 t2 -> let (a1 :< s1, a2 :< s2) = (runCofree t1, runCofree t2) in
wrap . (combine a1 a2 :<) . fmap go <$> contrast s1 s2
These t1 t2 -> wrap . (combine (extract t1) (extract t2) :<) . fmap go <$> contrast (unwrap t1) (unwrap t2)
_ -> Nothing