mirror of
https://github.com/github/semantic.git
synced 2024-12-25 16:02:43 +03:00
Compute term sizes as node counts.
This commit is contained in:
parent
4cce0deb34
commit
0b4696062d
@ -29,7 +29,4 @@ cata f (annotation :< syntax) = f annotation $ cata f <$> syntax
|
||||
-- | Return the number of leaves in the node.
|
||||
termSize :: Term a annotation -> Integer
|
||||
termSize = cata size where
|
||||
size _ (Leaf _) = 1
|
||||
size _ (Indexed i) = sum i
|
||||
size _ (Fixed f) = sum f
|
||||
size _ (Keyed k) = sum k
|
||||
size _ syntax = 1 + sum syntax
|
||||
|
Loading…
Reference in New Issue
Block a user