1
1
mirror of https://github.com/github/semantic.git synced 2024-11-29 02:44:36 +03:00

Rename iter to iterAp.

This commit is contained in:
Rob Rix 2016-09-25 16:21:40 +09:00
parent 66142c7281
commit 9e026bbe71
2 changed files with 3 additions and 3 deletions

View File

@ -20,8 +20,8 @@ data AlgorithmF term diff f
-- | The free applicative for 'AlgorithmF'. This enables us to construct diff values using <$> and <*> notation.
type Algorithm term diff = Ap (AlgorithmF term diff)
iter :: Functor g => (g a -> a) -> Ap g a -> a
iter algebra = go
iterAp :: Functor g => (g a -> a) -> Ap g a -> a
iterAp algebra = go
where go (Pure a) = a
go (Ap u q) = algebra (fmap (go . (`fmap` q) . flip ($)) u)

View File

@ -74,7 +74,7 @@ runAlgorithm :: (GAlign f, Traversable f, HasField fields (Vector.Vector Double)
-> SES.Cost (Free (CofreeF f (Both (Record fields))) (Patch (Cofree f (Record fields)))) -- ^ A function to compute the cost of a given diff node.
-> Algorithm (Cofree f (Record fields)) (Free (CofreeF f (Both (Record fields))) (Patch (Cofree f (Record fields)))) a -- ^ The algorithm to run.
-> a
runAlgorithm construct recur cost = Algorithm.iter $ \case
runAlgorithm construct recur cost = iterAp $ \case
Recursive a b f -> f (maybe (replacing a b) (construct . (both (extract a) (extract b) :<)) $ do
aligned <- galign (unwrap a) (unwrap b)
traverse (these (Just . deleting) (Just . inserting) recur) aligned)