1
1
mirror of https://github.com/github/semantic.git synced 2025-01-03 04:51:57 +03:00

Rephrase in terms of Applicative primitives.

This commit is contained in:
Rob Rix 2016-09-25 17:08:40 +09:00
parent ee80e76c1d
commit 64b491345e

View File

@ -24,7 +24,7 @@ type Algorithm term diff = Ap (AlgorithmF term diff)
iterAp :: Functor g => (g a -> a) -> Ap g a -> a
iterAp algebra = go
where go (Pure a) = a
go (Ap wrapped apply) = algebra (go . (<$> apply) . (&) <$> wrapped)
go (Ap wrapped apply) = algebra (go . (apply <*>) . pure <$> wrapped)
-- DSL