blob: 1024ecdfe83b9320c20f3e06e919d6640c37ba30 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
{-
This modules describes output data for the command line utlity.
-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
module Main.Output
( BillBudget(..)
, zipBills
) where
import GHC.Generics (Generic)
import Data.Aeson (ToJSON)
import Malodivo.Budget (DistrictFunds)
import Malodivo.Types.Bill (Bill)
import Main.DistrictInfo (DistrictInfo, df2di)
-- | This is output type. It describes contribution of each district into a bill.
data BillBudget = BillBudget
{ bill :: Bill
, districts :: [DistrictInfo]
} deriving (Generic, ToJSON)
zipBills :: [Bill] -> [DistrictFunds] -> [BillBudget]
zipBills = zipWith zipper
where
zipper b df = BillBudget {bill = b, districts = df2di df}
|