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

Move the definition of FAlgebra up.

This commit is contained in:
Rob Rix 2017-04-24 15:41:17 -04:00
parent 82a40d19ff
commit fa520d6089

View File

@ -109,6 +109,10 @@ optional :: Assignment (Node Grammar) (Term Syntax Location) -> Assignment (Node
optional a = a <|> term <*> pure Syntax.Empty optional a = a <|> term <*> pure Syntax.Empty
-- | An F-algebra on some carrier functor 'f'.
type FAlgebra f a = f a -> a
-- | Produce a list of identifiable subterms of a given term. -- | Produce a list of identifiable subterms of a given term.
-- --
-- By “identifiable” we mean terms which have a user-assigned identifier associated with them, & which serve as a declaration rather than a reference; i.e. the declaration of a class or method or binding of a variable are all identifiable terms, but calling a named function or referencing a parameter is not. -- By “identifiable” we mean terms which have a user-assigned identifier associated with them, & which serve as a declaration rather than a reference; i.e. the declaration of a class or method or binding of a variable are all identifiable terms, but calling a named function or referencing a parameter is not.
@ -127,9 +131,6 @@ cyclomaticComplexityAlg (_ :< union) = case union of
_ | Just Statement.Yield{} <- prj union -> succ (sum union) _ | Just Statement.Yield{} <- prj union -> succ (sum union)
_ -> sum union _ -> sum union
-- | 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. -- | Lift an algebra into a decorator for terms annotated with records.
decoratorWithAlgebra :: Functor f decoratorWithAlgebra :: Functor f
=> FAlgebra (Base (Term f (Record fs))) a -- ^ An F-algebra on terms. => FAlgebra (Base (Term f (Record fs))) a -- ^ An F-algebra on terms.