module LoggedIn.Monthly.Update ( update ) where import LoggedIn.Monthly.Action as MonthlyAction import LoggedIn.Monthly.Model as MonthlyModel update : MonthlyAction.Action -> MonthlyModel.Model -> MonthlyModel.Model update action monthly = case action of MonthlyAction.ToggleDetail -> { monthly | visibleDetail = not monthly.visibleDetail } MonthlyAction.AddPayment payment -> { monthly | payments = payment :: monthly.payments , visibleDetail = True } MonthlyAction.DeletePayment payment -> { monthly | payments = List.filter (((/=) payment.id) << .id) monthly.payments }