From bee4b4b06ed1d195edf2bc30c5e683aa2f6f1785 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Mon, 24 Apr 2017 15:55:09 -0400 Subject: [PATCH] Define a type synonym for course-of-value algebras. --- src/Language/Ruby/Syntax.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Language/Ruby/Syntax.hs b/src/Language/Ruby/Syntax.hs index 3957c0805..70eb5028b 100644 --- a/src/Language/Ruby/Syntax.hs +++ b/src/Language/Ruby/Syntax.hs @@ -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