2016-06-17 17:26:20 +03:00
|
|
|
{-# LANGUAGE DataKinds, FlexibleContexts, TypeOperators #-}
|
2016-03-31 00:12:39 +03:00
|
|
|
module Info where
|
2016-03-31 00:26:52 +03:00
|
|
|
|
2016-06-17 17:26:20 +03:00
|
|
|
import Data.Record
|
2016-05-26 19:58:04 +03:00
|
|
|
import Prologue
|
2016-03-31 00:26:52 +03:00
|
|
|
import Category
|
|
|
|
import Range
|
|
|
|
|
2016-06-17 17:26:20 +03:00
|
|
|
newtype RangeA = RangeA { unRangeA :: Range }
|
|
|
|
newtype CategoryA = CategoryA { unCategoryA :: Category }
|
|
|
|
newtype SizeA = SizeA { unSizeA :: Integer }
|
|
|
|
newtype CostA = CostA { unCostA :: Integer }
|
|
|
|
|
|
|
|
type InfoFields = '[ RangeA, CategoryA, SizeA, CostA ]
|
|
|
|
|
|
|
|
type Info' = Record InfoFields
|
|
|
|
|
|
|
|
characterRange' :: HasField fields RangeA => Record fields -> Range
|
|
|
|
characterRange' = unRangeA . getField
|
|
|
|
|
|
|
|
category' :: HasField fields CategoryA => Record fields -> Category
|
|
|
|
category' = unCategoryA . getField
|
|
|
|
|
|
|
|
size' :: HasField fields SizeA => Record fields -> Integer
|
|
|
|
size' = unSizeA . getField
|
|
|
|
|
|
|
|
cost' :: HasField fields CostA => Record fields -> Integer
|
|
|
|
cost' = unCostA . getField
|
|
|
|
|
2016-03-31 00:26:52 +03:00
|
|
|
-- | An annotation for a source file, including the source range and semantic
|
|
|
|
-- | categories.
|
2016-06-03 06:34:16 +03:00
|
|
|
data Info = Info { characterRange :: !Range, category :: !Category, size :: !Integer, cost :: !Integer }
|
2016-03-31 00:26:52 +03:00
|
|
|
deriving (Eq, Show)
|