getFlow :: [Transaction] -> Map String Integer
getFlow = foldr flows Map.empty
  where flows t = Map.insertWith (+) (to t) (amount t) .
                  Map.insertWith (+) (from t) (negate $ amount t)

-- Exercise 6 -----------------------------------------
getFlow :: [Transaction] -> Map String Integer
getFlow = foldr flows Map.empty
  where flows t = Map.insertWith (+) (to t) (amount t) .
                  Map.insertWith (+) (from t) (negate $ amount t)

-- Exercise 6 -----------------------------------------
getFlow = foldr flows Map.empty
  where flows t = Map.insertWith (+) (to t) (amount t) .
                  Map.insertWith (+) (from t) (negate $ amount t)

-- Exercise 6 -----------------------------------------