XQBYALGEDBGQIHMEI4FFDGMQCMOPE4SJLBDROYF5YVMU7H5IKV6AC
modifyCopies = undefined
modifyCategory = undefined
move old new = R $ \card ->
let removeOld x = x & categories %~ Map.delete (toText old)
oldCopies = card ^? categories . ix (toText old) . copies
updateCopies x =
Map.alter
( \case
Nothing -> Just $ Category new x
Just oldCategory -> Just $ oldCategory & copies %~ uncheckedAdd x
)
(toText new)
(card ^. categories)
in oldCopies <&> removeOld . (\x -> card & categories .~ updateCopies x)
card ^. categories . at categoryName
<&> toNumber @Int
<&> (+ delta)
update x = card & (categories . ix (toText category)) .~ x
card ^? categories . ix (toText category) . copies
<&> (+ delta) . toNumber @Int
update x = card & (categories . ix (toText category) . copies) .~ x