1
1
mirror of https://github.com/github/semantic.git synced 2025-01-03 13:02:37 +03:00

Define a type synonym for course-of-value algebras.

This commit is contained in:
Rob Rix 2017-04-24 15:55:09 -04:00
parent bc3fc4b4af
commit bee4b4b06e

View File

@ -115,6 +115,9 @@ type FAlgebra t a = Base t a -> a
-- | An R-algebra on the base functor of some type 't'.
type RAlgebra t a = Base t (t, a) -> a
-- | A CV-algebra (Course of Value) on the base functor of some type 't'; an algebra which provides its references upon request.
type CVAlgebra t a = Base t (Cofree (Base t) a) -> a
-- | Promote an FAlgebra into an RAlgebra (by dropping the original parameter).
fToR :: Functor (Base t) => FAlgebra t a -> RAlgebra t a
fToR f = f . fmap snd