Skip to content

Instantly share code, notes, and snippets.

@simonmichael
Created June 5, 2009 07:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simonmichael/124122 to your computer and use it in GitHub Desktop.
Save simonmichael/124122 to your computer and use it in GitHub Desktop.
95-- | Get the string representation of an amount, based on its commodity's
96-- display settings.
97showAmount ∷ Amount → String
98--showAmount a@(Amount (Commodity {symbol=sym,side=side,spaced=spaced}) _ pri)
99showAmount a@(Amount (Commodity sym side spaced _ _) _ pri)
100 | sym=="AUTO" = "" -- can display one of these in an error message
101 | side==L = printf "%s%s%s%s" sym space quantity price
102 | side==R = printf "%s%s%s%s" quantity space sym price
103 where
104 space = if spaced then " " else ""
105 quantity = showAmount' a
106 price = case pri of (Just pamt) → " @ " ++ showMixedAmount pamt
107 Nothing → ""
Ledger/Amount.hs:99:0:
Warning: Pattern match(es) are non-exhaustive
In the definition of `showAmount':
Patterns not matched: Amount (Commodity _ _ _ _ _) _ _
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment