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

📝 rToCV.

This commit is contained in:
Rob Rix 2017-04-24 16:00:06 -04:00
parent 4ac68417a2
commit 440cc2e792

View File

@ -122,6 +122,7 @@ type CVAlgebra t a = Base t (Cofree (Base t) a) -> a
fToR :: Functor (Base t) => FAlgebra t a -> RAlgebra t a
fToR f = f . fmap snd
-- | Promote an RAlgebra into a CVAlgebra (by dropping all values except the most recent).
rToCV :: (Functor (Base t), Corecursive t) => RAlgebra t a -> CVAlgebra t a
rToCV r = r . fmap (cata (embed . tailF) &&& extract)