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