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

Add a function to decorate a term with the assistance of a decorating function.

This commit is contained in:
Rob Rix 2016-07-15 17:31:19 -04:00
parent 30ef58c6fd
commit 96c728a9ca

View File

@ -77,6 +77,9 @@ readAndTranscodeFile path = do
text <- B1.readFile path text <- B1.readFile path
transcode text transcode text
decorateTerm :: Functor f => (CofreeF f (Record fields) (Record (field ': fields)) -> field) -> Cofree f (Record fields) -> Cofree f (Record (field ': fields))
decorateTerm decorator = cata $ \ c -> cofree ((decorator (extract <$> c) .: headF c) :< tailF c)
-- | Given a parser and renderer, diff two sources and return the rendered -- | Given a parser and renderer, diff two sources and return the rendered
-- | result. -- | result.
-- | Returns the rendered result strictly, so it's always fully evaluated -- | Returns the rendered result strictly, so it's always fully evaluated