mirror of
https://github.com/github/semantic.git
synced 2025-01-07 07:58:12 +03:00
38 lines
926 B
Haskell
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
|