mirror of
https://github.com/simonmichael/hledger.git
synced 2024-12-27 12:24:43 +03:00
lib: Remove unnecessary NFData instances.
This commit is contained in:
parent
af31d6e140
commit
2cd7877c46
@ -28,7 +28,6 @@ module Hledger.Data.Types
|
||||
where
|
||||
|
||||
import GHC.Generics (Generic)
|
||||
import Control.DeepSeq (NFData)
|
||||
import Data.Decimal
|
||||
import Data.Default
|
||||
import Data.Functor (($>))
|
||||
@ -79,8 +78,6 @@ data DateSpan = DateSpan (Maybe Day) (Maybe Day) deriving (Eq,Ord,Generic)
|
||||
|
||||
instance Default DateSpan where def = DateSpan Nothing Nothing
|
||||
|
||||
instance NFData DateSpan
|
||||
|
||||
-- synonyms for various date-related scalars
|
||||
type Year = Integer
|
||||
type Month = Int -- 1-12
|
||||
@ -135,8 +132,6 @@ data Interval =
|
||||
|
||||
instance Default Interval where def = NoInterval
|
||||
|
||||
instance NFData Interval
|
||||
|
||||
type AccountName = Text
|
||||
|
||||
data AccountType =
|
||||
@ -148,8 +143,6 @@ data AccountType =
|
||||
| Cash -- ^ a subtype of Asset - liquid assets to show in cashflow report
|
||||
deriving (Show,Eq,Ord,Generic)
|
||||
|
||||
instance NFData AccountType
|
||||
|
||||
-- not worth the trouble, letters defined in accountdirectivep for now
|
||||
--instance Read AccountType
|
||||
-- where
|
||||
@ -164,12 +157,8 @@ data AccountAlias = BasicAlias AccountName AccountName
|
||||
| RegexAlias Regexp Replacement
|
||||
deriving (Eq, Read, Show, Ord, Generic)
|
||||
|
||||
-- instance NFData AccountAlias
|
||||
|
||||
data Side = L | R deriving (Eq,Show,Read,Ord,Generic)
|
||||
|
||||
instance NFData Side
|
||||
|
||||
-- | The basic numeric type used in amounts.
|
||||
type Quantity = Decimal
|
||||
-- The following is for hledger-web, and requires blaze-markup.
|
||||
@ -184,8 +173,6 @@ instance ToMarkup Quantity
|
||||
data AmountPrice = UnitPrice Amount | TotalPrice Amount
|
||||
deriving (Eq,Ord,Generic,Show)
|
||||
|
||||
instance NFData AmountPrice
|
||||
|
||||
-- | Display style for an amount.
|
||||
data AmountStyle = AmountStyle {
|
||||
ascommodityside :: Side, -- ^ does the symbol appear on the left or the right ?
|
||||
@ -195,8 +182,6 @@ data AmountStyle = AmountStyle {
|
||||
asdigitgroups :: Maybe DigitGroupStyle -- ^ style for displaying digit groups, if any
|
||||
} deriving (Eq,Ord,Read,Generic)
|
||||
|
||||
instance NFData AmountStyle
|
||||
|
||||
instance Show AmountStyle where
|
||||
show AmountStyle{..} =
|
||||
printf "AmountStylePP \"%s %s %s %s %s..\""
|
||||
@ -208,8 +193,6 @@ instance Show AmountStyle where
|
||||
|
||||
data AmountPrecision = Precision !Word8 | NaturalPrecision deriving (Eq,Ord,Read,Show,Generic)
|
||||
|
||||
instance NFData AmountPrecision
|
||||
|
||||
-- | A style for displaying digit groups in the integer part of a
|
||||
-- floating point number. It consists of the character used to
|
||||
-- separate groups (comma or period, whichever is not used as decimal
|
||||
@ -219,8 +202,6 @@ instance NFData AmountPrecision
|
||||
data DigitGroupStyle = DigitGroups Char [Word8]
|
||||
deriving (Eq,Ord,Read,Show,Generic)
|
||||
|
||||
instance NFData DigitGroupStyle
|
||||
|
||||
type CommoditySymbol = Text
|
||||
|
||||
data Commodity = Commodity {
|
||||
@ -228,8 +209,6 @@ data Commodity = Commodity {
|
||||
cformat :: Maybe AmountStyle
|
||||
} deriving (Show,Eq,Generic) --,Ord)
|
||||
|
||||
instance NFData Commodity
|
||||
|
||||
data Amount = Amount {
|
||||
acommodity :: CommoditySymbol, -- commodity symbol, or special value "AUTO"
|
||||
aquantity :: Quantity, -- numeric quantity, or zero in case of "AUTO"
|
||||
@ -239,17 +218,11 @@ data Amount = Amount {
|
||||
aprice :: Maybe AmountPrice -- ^ the (fixed, transaction-specific) price for this amount, if any
|
||||
} deriving (Eq,Ord,Generic,Show)
|
||||
|
||||
instance NFData Amount
|
||||
|
||||
newtype MixedAmount = Mixed [Amount] deriving (Eq,Ord,Generic,Show)
|
||||
|
||||
instance NFData MixedAmount
|
||||
|
||||
data PostingType = RegularPosting | VirtualPosting | BalancedVirtualPosting
|
||||
deriving (Eq,Show,Generic)
|
||||
|
||||
instance NFData PostingType
|
||||
|
||||
type TagName = Text
|
||||
type TagValue = Text
|
||||
type Tag = (TagName, TagValue) -- ^ A tag name and (possibly empty) value.
|
||||
@ -260,8 +233,6 @@ type DateTag = (TagName, Day)
|
||||
data Status = Unmarked | Pending | Cleared
|
||||
deriving (Eq,Ord,Bounded,Enum,Generic)
|
||||
|
||||
instance NFData Status
|
||||
|
||||
instance Show Status where -- custom show.. bad idea.. don't do it..
|
||||
show Unmarked = ""
|
||||
show Pending = "!"
|
||||
@ -311,8 +282,6 @@ data BalanceAssertion = BalanceAssertion {
|
||||
baposition :: GenericSourcePos -- ^ the assertion's file position, for error reporting
|
||||
} deriving (Eq,Generic,Show)
|
||||
|
||||
instance NFData BalanceAssertion
|
||||
|
||||
data Posting = Posting {
|
||||
pdate :: Maybe Day, -- ^ this posting's date, if different from the transaction's
|
||||
pdate2 :: Maybe Day, -- ^ this posting's secondary date, if different from the transaction's
|
||||
@ -332,8 +301,6 @@ data Posting = Posting {
|
||||
-- untransformed posting (which will have Nothing in this field).
|
||||
} deriving (Generic)
|
||||
|
||||
instance NFData Posting
|
||||
|
||||
-- The equality test for postings ignores the parent transaction's
|
||||
-- identity, to avoid recurring ad infinitum.
|
||||
-- XXX could check that it's Just or Nothing.
|
||||
@ -362,8 +329,6 @@ data GenericSourcePos = GenericSourcePos FilePath Int Int -- ^ file path, 1-b
|
||||
| JournalSourcePos FilePath (Int, Int) -- ^ file path, inclusive range of 1-based line numbers (first, last).
|
||||
deriving (Eq, Read, Show, Ord, Generic)
|
||||
|
||||
instance NFData GenericSourcePos
|
||||
|
||||
--{-# ANN Transaction "HLint: ignore" #-}
|
||||
-- Ambiguous type variable ‘p0’ arising from an annotation
|
||||
-- prevents the constraint ‘(Data p0)’ from being solved.
|
||||
@ -382,8 +347,6 @@ data Transaction = Transaction {
|
||||
tpostings :: [Posting] -- ^ this transaction's postings
|
||||
} deriving (Eq,Generic,Show)
|
||||
|
||||
instance NFData Transaction
|
||||
|
||||
-- | A transaction modifier rule. This has a query which matches postings
|
||||
-- in the journal, and a list of transformations to apply to those
|
||||
-- postings or their transactions. Currently there is one kind of transformation:
|
||||
@ -394,8 +357,6 @@ data TransactionModifier = TransactionModifier {
|
||||
tmpostingrules :: [TMPostingRule]
|
||||
} deriving (Eq,Generic,Show)
|
||||
|
||||
instance NFData TransactionModifier
|
||||
|
||||
nulltransactionmodifier = TransactionModifier{
|
||||
tmquerytxt = ""
|
||||
,tmpostingrules = []
|
||||
@ -433,12 +394,8 @@ nullperiodictransaction = PeriodicTransaction{
|
||||
,ptpostings = []
|
||||
}
|
||||
|
||||
instance NFData PeriodicTransaction
|
||||
|
||||
data TimeclockCode = SetBalance | SetRequiredHours | In | Out | FinalOut deriving (Eq,Ord,Generic)
|
||||
|
||||
instance NFData TimeclockCode
|
||||
|
||||
data TimeclockEntry = TimeclockEntry {
|
||||
tlsourcepos :: GenericSourcePos,
|
||||
tlcode :: TimeclockCode,
|
||||
@ -447,8 +404,6 @@ data TimeclockEntry = TimeclockEntry {
|
||||
tldescription :: Text
|
||||
} deriving (Eq,Ord,Generic)
|
||||
|
||||
instance NFData TimeclockEntry
|
||||
|
||||
-- | A market price declaration made by the journal format's P directive.
|
||||
-- It declares two things: a historical exchange rate between two commodities,
|
||||
-- and an amount display style for the second commodity.
|
||||
@ -459,8 +414,6 @@ data PriceDirective = PriceDirective {
|
||||
} deriving (Eq,Ord,Generic,Show)
|
||||
-- Show instance derived in Amount.hs (XXX why ?)
|
||||
|
||||
instance NFData PriceDirective
|
||||
|
||||
-- | A historical market price (exchange rate) from one commodity to another.
|
||||
-- A more concise form of a PriceDirective, without the amount display info.
|
||||
data MarketPrice = MarketPrice {
|
||||
@ -471,8 +424,6 @@ data MarketPrice = MarketPrice {
|
||||
} deriving (Eq,Ord,Generic)
|
||||
-- Show instance derived in Amount.hs (XXX why ?)
|
||||
|
||||
instance NFData MarketPrice
|
||||
|
||||
-- additional valuation-related types in Valuation.hs
|
||||
|
||||
-- | A Journal, containing transactions and various other things.
|
||||
@ -512,8 +463,6 @@ data Journal = Journal {
|
||||
} deriving (Eq, Generic)
|
||||
|
||||
deriving instance Generic ClockTime
|
||||
instance NFData ClockTime
|
||||
-- instance NFData Journal
|
||||
|
||||
-- | A journal in the process of being parsed, not yet finalised.
|
||||
-- The data is partial, and list fields are in reverse order.
|
||||
@ -532,8 +481,6 @@ data AccountDeclarationInfo = AccountDeclarationInfo {
|
||||
-- relative to other account declarations, during parsing (1..)
|
||||
} deriving (Eq,Show,Generic)
|
||||
|
||||
instance NFData AccountDeclarationInfo
|
||||
|
||||
nullaccountdeclarationinfo = AccountDeclarationInfo {
|
||||
adicomment = ""
|
||||
,aditags = []
|
||||
|
@ -28,7 +28,6 @@ module Hledger.Data.Valuation (
|
||||
where
|
||||
|
||||
import Control.Applicative ((<|>))
|
||||
import Control.DeepSeq (NFData)
|
||||
import Data.Decimal (roundTo)
|
||||
import Data.Function ((&), on)
|
||||
import Data.Graph.Inductive (Gr, Node, NodeMap, mkMapGraph, mkNode, lab, out, sp)
|
||||
@ -86,8 +85,6 @@ data PriceGraph = PriceGraph {
|
||||
}
|
||||
deriving (Show,Generic)
|
||||
|
||||
instance NFData PriceGraph
|
||||
|
||||
-- | A price oracle is a magic memoising function that efficiently
|
||||
-- looks up market prices (exchange rates) from one commodity to
|
||||
-- another (or if unspecified, to a default valuation commodity) on a
|
||||
|
@ -1,10 +1,10 @@
|
||||
cabal-version: 1.12
|
||||
|
||||
-- This file has been generated from package.yaml by hpack version 0.33.0.
|
||||
-- This file has been generated from package.yaml by hpack version 0.34.2.
|
||||
--
|
||||
-- see: https://github.com/sol/hpack
|
||||
--
|
||||
-- hash: ca2b9f025d75c0b65f91b2e5fe7203d00d1d9f8c423c8c4f0cb7675df848a5aa
|
||||
-- hash: e8ee8c99329f53fe86ae9df138d05c8c39726a66da2ad1da3ae27500c45b2591
|
||||
|
||||
name: hledger-lib
|
||||
version: 1.18.99
|
||||
@ -124,7 +124,6 @@ library
|
||||
, cmdargs >=0.10
|
||||
, containers
|
||||
, data-default >=0.5
|
||||
, deepseq
|
||||
, directory
|
||||
, extra >=1.6.3
|
||||
, fgl >=5.5.4.0
|
||||
@ -177,7 +176,6 @@ test-suite doctest
|
||||
, cmdargs >=0.10
|
||||
, containers
|
||||
, data-default >=0.5
|
||||
, deepseq
|
||||
, directory
|
||||
, doctest >=0.16.3
|
||||
, extra >=1.6.3
|
||||
@ -233,7 +231,6 @@ test-suite unittest
|
||||
, cmdargs >=0.10
|
||||
, containers
|
||||
, data-default >=0.5
|
||||
, deepseq
|
||||
, directory
|
||||
, extra >=1.6.3
|
||||
, fgl >=5.5.4.0
|
||||
|
@ -59,7 +59,6 @@ dependencies:
|
||||
- cassava-megaparsec
|
||||
- data-default >=0.5
|
||||
- Decimal >=0.5.1
|
||||
- deepseq
|
||||
- directory
|
||||
- fgl >=5.5.4.0
|
||||
- file-embed >=0.0.10
|
||||
|
Loading…
Reference in New Issue
Block a user