1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 14:21:31 +03:00

Rename contrast to compare.

This commit is contained in:
Rob Rix 2016-07-11 14:27:38 -04:00
parent 42f18e9b4f
commit d9c5411568

View File

@ -37,7 +37,7 @@ termSize = cata size where
size (_ :< syntax) = 1 + sum syntax size (_ :< syntax) = 1 + sum syntax
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 :: 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 alignCofreeWith compare combine = go
where go terms = fromMaybe (pure terms) $ case terms of where go terms = fromMaybe (pure terms) $ case terms of
These t1 t2 -> wrap . (combine (extract t1) (extract t2) :<) . fmap go <$> contrast (unwrap t1) (unwrap t2) These t1 t2 -> wrap . (combine (extract t1) (extract t2) :<) . fmap go <$> compare (unwrap t1) (unwrap t2)
_ -> Nothing _ -> Nothing