2016-06-17 17:45:41 +03:00
|
|
|
{-# LANGUAGE DataKinds, FlexibleContexts #-}
|
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 18:22:22 +03:00
|
|
|
newtype Size = Size { unSize :: Integer }
|
|
|
|
newtype Cost = Cost { unCost :: Integer }
|
2016-06-17 17:26:20 +03:00
|
|
|
|
2016-06-17 18:22:22 +03:00
|
|
|
type InfoFields = '[ Range, Category, Size, Cost ]
|
2016-06-17 17:26:20 +03:00
|
|
|
|
|
|
|
type Info' = Record InfoFields
|
|
|
|
|
2016-06-17 18:15:22 +03:00
|
|
|
characterRange' :: HasField fields Range => Record fields -> Range
|
|
|
|
characterRange' = getField
|
2016-06-17 17:26:20 +03:00
|
|
|
|
2016-06-17 18:15:22 +03:00
|
|
|
setCharacterRange' :: SetField fields Range => Record fields -> Range -> Record fields
|
|
|
|
setCharacterRange' = setField
|
2016-06-17 17:29:24 +03:00
|
|
|
|
2016-06-17 18:15:22 +03:00
|
|
|
category' :: HasField fields Category => Record fields -> Category
|
|
|
|
category' = getField
|
2016-06-17 17:26:20 +03:00
|
|
|
|
2016-06-17 18:15:22 +03:00
|
|
|
setCategory' :: SetField fields Category => Record fields -> Category -> Record fields
|
|
|
|
setCategory' = setField
|
2016-06-17 17:29:24 +03:00
|
|
|
|
2016-06-17 18:22:22 +03:00
|
|
|
size' :: HasField fields Size => Record fields -> Size
|
|
|
|
size' = getField
|
2016-06-17 17:26:20 +03:00
|
|
|
|
2016-06-17 18:22:22 +03:00
|
|
|
setSize' :: SetField fields Size => Record fields -> Size -> Record fields
|
|
|
|
setSize' = setField
|
2016-06-17 17:29:24 +03:00
|
|
|
|
2016-06-17 18:22:22 +03:00
|
|
|
cost' :: HasField fields Cost => Record fields -> Cost
|
|
|
|
cost' = getField
|
2016-06-17 17:26:20 +03:00
|
|
|
|
2016-06-17 18:22:22 +03:00
|
|
|
setCost' :: SetField fields Cost => Record fields -> Cost -> Record fields
|
|
|
|
setCost' = setField
|
2016-06-17 17:29:24 +03:00
|
|
|
|
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)
|