Serialization of predicates

Fixes #1062
the mixin has the hashCode cached, so this should cause only a minimal performance penalty