The solution is to not use higher order functions like ‘alter’. The benefits of acid-state (ACID guarantees, running code remotely, etc) comes at the cost of only using serialisable data. This
restriction is unlikely to ever be lifted.
Usually this is a not a big problem; Just specialise your code. If this doesn’t cut it, maybe you want to keep your state in an MVar.