imilarAmountsUsingFirstPrice :: Amount -> Amount -> Amount
sumSimilarAmountsUsingFirstPrice a b = (a + b){aprice=p}
  where
    p = case (aprice a, aprice b) of
        (Just (TotalPrice ap), Just (TotalPrice bp))
          -> Just . TotalPrice $ ap{aquantity = aquantity ap + aquantity bp }
        _ -> aprice a

-- -- | Sum same-commodity amounts. If there were different prices, set
-- -- the price to a special marker indicating "various". Only used as a
-- -- rendering helper.
-- sumSimilarAmountsNotingPriceDifference :: [Amount] -> Amount
-- sumSimilarAmountsNotingPriceDifference [] = nullamt
-- sumSimilarAmountsNotingPriceDifference as = undefined

-- | Filter a mixed amount's component amounts by a predicate.
fil
sumSimilarAmountsUsingFirstPrice :: Amount -> Amount -> Amount
sumSimilarAmountsUsingFirstPrice a b = (a + b){aprice=p}
  where
    p = case (aprice a, aprice b) of
        (Just (TotalPrice ap), Just (TotalPrice bp))
          -> Just . TotalPrice $ ap{aquantity = aquantity ap + aquantity bp }
        _ -> aprice a

-- -- | Sum same-commodity amounts. If there were different prices, set
-- -- the price to a special marker indicating "various". Only used as a
-- -- rendering helper.
-- sumSimilarAmountsNotingPriceDifference :: [Amount] -> Amount
-- sumSimilarAmountsNotingPriceDifference [] = nullamt
-- sumSimilarAmountsNotingPriceDifference as = undefined

-- | Filter a mixed amount's component amounts by a predicate.
sumSimilarAmountsUsingFirstPrice a b = (a + b){aprice=p}
  where
    p = case (aprice a, aprice b) of
        (Just (TotalPrice ap), Just (TotalPrice bp))
          -> Just . TotalPrice $ ap{aquantity = aquantity ap + aquantity bp }
        _ -> aprice a

-- -- | Sum same-commodity amounts. If there were different prices, set
-- -- the price to a special marker indicating "various". Only used as a
-- -- rendering helper.
-- sumSimilarAmountsNotingPriceDifference :: [Amount] -> Amount
-- sumSimilarAmountsNotingPriceDifference [] = nullamt
-- sumSimilarAmountsNotingPriceDifference as = undefined

-- | Filter a mixed amount's component amounts by a predicate.