1
1
mirror of https://github.com/github/semantic.git synced 2024-12-21 05:41:54 +03:00
semantic/src/Info.hs
2016-05-17 15:59:07 -04:00

18 lines
513 B
Haskell

module Info where
import Data.Maybe (listToMaybe)
import Category
import Data.Set
import Range
-- | An annotation for a source file, including the source range and semantic
-- | categories.
data Info = Info { characterRange :: !Range, categories :: !(Set Category), size :: !Integer }
deriving (Eq, Show)
instance Categorizable Info where
categories = Info.categories
maybeFirstCategory :: (Categorizable a) => a -> Maybe Category
maybeFirstCategory term = listToMaybe . toList $ Category.categories term