add partial functions and EncodedAdt type class