mirror of
https://github.com/github/semantic.git
synced 2024-12-22 22:31:36 +03:00
📝 decoratorWithAlgebra.
This commit is contained in:
parent
5201cb3f46
commit
0a6555351b
@ -130,5 +130,6 @@ cyclomaticComplexity = cata $ \ (_ :< union) -> case union of
|
||||
-- | An F-algebra on some carrier functor 'f'.
|
||||
type FAlgebra f a = f a -> a
|
||||
|
||||
-- | Lift an algebra into a decorator for terms annotated with records.
|
||||
decoratorWithAlgebra :: Functor f => FAlgebra (Base (Term f (Record fs))) a -> Term f (Record fs) -> Term f (Record (a ': fs))
|
||||
decoratorWithAlgebra alg = cata $ \ c@(a :< f) -> cofree $ (alg (fmap (rhead . extract) c) :. a) :< f
|
||||
|
Loading…
Reference in New Issue
Block a user