1
1
mirror of https://github.com/github/semantic.git synced 2024-12-24 23:42:31 +03:00

Don’t wrap Range & Category in newtypes.

This commit is contained in:
Rob Rix 2016-06-17 11:15:22 -04:00
parent ed1b0b692d
commit 138f66ae0d

View File

@ -6,26 +6,24 @@ import Prologue
import Category
import Range
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 InfoFields = '[ Range, Category, SizeA, CostA ]
type Info' = Record InfoFields
characterRange' :: HasField fields RangeA => Record fields -> Range
characterRange' = unRangeA . getField
characterRange' :: HasField fields Range => Record fields -> Range
characterRange' = getField
setCharacterRange' :: SetField fields RangeA => Record fields -> Range -> Record fields
setCharacterRange' record = setField record . RangeA
setCharacterRange' :: SetField fields Range => Record fields -> Range -> Record fields
setCharacterRange' = setField
category' :: HasField fields CategoryA => Record fields -> Category
category' = unCategoryA . getField
category' :: HasField fields Category => Record fields -> Category
category' = getField
setCategory' :: SetField fields CategoryA => Record fields -> Category -> Record fields
setCategory' record = setField record . CategoryA
setCategory' :: SetField fields Category => Record fields -> Category -> Record fields
setCategory' = setField
size' :: HasField fields SizeA => Record fields -> Integer
size' = unSizeA . getField