1
1
mirror of https://github.com/github/semantic.git synced 2025-01-07 07:58:12 +03:00
semantic/src/Info.hs
Rob Rix b96f60be92 🔥 Size.
2016-07-15 11:18:26 -04:00

38 lines
926 B
Haskell

{-# LANGUAGE DataKinds, GeneralizedNewtypeDeriving #-}
module Info where
import Data.Record
import Prologue
import Category
import Range
import Test.QuickCheck
newtype Cost = Cost { unCost :: Integer }
deriving (Eq, Num, Ord, Show)
characterRange :: HasField fields Range => Record fields -> Range
characterRange = getField
setCharacterRange :: HasField fields Range => Record fields -> Range -> Record fields
setCharacterRange = setField
category :: HasField fields Category => Record fields -> Category
category = getField
setCategory :: HasField fields Category => Record fields -> Category -> Record fields
setCategory = setField
cost :: HasField fields Cost => Record fields -> Cost
cost = getField
setCost :: HasField fields Cost => Record fields -> Cost -> Record fields
setCost = setField
-- Instances
instance Arbitrary Cost where
arbitrary = Cost <$> arbitrary
shrink = fmap Cost . shrink . unCost