1
1
mirror of https://github.com/github/semantic.git synced 2024-12-01 00:33:59 +03:00

Document declarations in Categorizable.hs

This commit is contained in:
Matt Diephouse 2016-01-14 09:17:12 -05:00
parent 50422673b6
commit 640449e2f3

View File

@ -5,12 +5,14 @@ import Term
import Control.Comonad.Cofree
import Data.Set
-- | The class of types that have categories.
class Categorizable a where
categories :: a -> Set String
instance Categorizable annotation => Categorizable (Term a annotation) where
categories (annotation :< _) = categories annotation
-- | Test whether the categories from the categorizables intersect.
comparable :: Categorizable a => a -> a -> Bool
comparable a b = catsA == catsB || (not . Data.Set.null $ intersection catsA catsB)
where