diff options
-rw-r--r-- | cmd/Main.hs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/cmd/Main.hs b/cmd/Main.hs index 35a42a6..7af6a83 100644 --- a/cmd/Main.hs +++ b/cmd/Main.hs @@ -5,6 +5,7 @@ module Main ) where import Control.Monad (when) +import Data.Maybe (fromMaybe) import Data.Version (showVersion) import System.Environment (getArgs) import System.Exit (die) @@ -16,11 +17,12 @@ import System.Console.Docopt.NoTH (isPresent, longOption, parseArgsOrExit, parseUsageOrExit, usage) import Text.InterpolatedString.Perl6 (qc) -import Malodivo.Budget (manyToMany) +import Malodivo.Budget (manyToManyLimited) +import Malodivo.Types.District (di2df) +import Malodivo.Types.Ministry (mi2ml) import qualified Main.Input as I import qualified Main.Output as O -import Malodivo.Types.District (di2df) import Paths_malodivo (version) -- from cabal usageHelp :: String @@ -49,8 +51,10 @@ process = do Right si -> let allBills = I.bills si suppliedFunds = di2df $ I.districts si + ministryLimits = mi2ml $ fromMaybe [] (I.ministries si) in do when (HM.null suppliedFunds) $ die "We needs at least one district" - L.putStr . encode . O.encode $ manyToMany suppliedFunds allBills + L.putStr . encode . O.encode $ + manyToManyLimited suppliedFunds ministryLimits allBills main :: IO () main = do |