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

15 lines
411 B
Haskell
Raw Normal View History

2015-11-18 22:23:28 +03:00
module Categorizable where
2015-11-18 22:23:35 +03:00
2015-11-27 20:02:15 +03:00
import Term
import Control.Comonad.Cofree
2015-11-18 22:23:35 +03:00
import Data.Set
class Categorizable a where
categories :: a -> Set String
2015-11-27 20:02:15 +03:00
instance Categorizable annotation => Categorizable (Term a annotation) where
categories (annotation :< _) = categories annotation
comparable :: Categorizable a => a -> a -> Bool
comparable a b = not . Data.Set.null $ intersection (categories a) (categories b)