a webapp to manage expenses between a group of friends. NOTE: this is really out of date and may not work. see housetab-snap — http://housetab.org
pickSpent purchases (p, a) = (p, spent, a - spent)
where spent = sum $ map ammount $ filter (\pur -> purchaser pur == p) purchases
pickSpent purchases (p, a) = (p, spent - paybacks, a - spent)
where count ps = sum $ map ammount $ ps
spent = count $ filter (\pur -> purchaser pur == p) purchases
-- this is because the total spent looks strange when you don't factor these in.
-- a payback is classified by one person directly paying another (ie, the first
-- is the spender, the receiver is only splitter)
paybacks = count $ filter (\pur -> (length (payers pur) == 1) && (head (payers pur) == p) && (purchaser pur /= p)) purchases