From 138f66ae0d443badbfd29f94e92e5cf3740e26ef Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Fri, 17 Jun 2016 11:15:22 -0400 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20wrap=20Range=20&=20Category=20i?= =?UTF-8?q?n=20newtypes.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Info.hs | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/Info.hs b/src/Info.hs index fc594e36f..98500b69a 100644 --- a/src/Info.hs +++ b/src/Info.hs @@ -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