Sometimes a data type wants to normalize values for a field, usually so it can accept a broad range of inputs while still preserving meaningful equality semantics. For example, a board game data type may wish to represent the pieces on the board as a set?, but allow construction from any sequence? of pieces. In order to keep equality sensible, at construction time the sequence of pieces should be deduplicated and placed into an unordered set? so that the order of the input sequence doesn't affect whether two boards are equal?.
It would be handy to have some integration with rebellion/type for this kind of thing. Whether that means a #:normalizer keyword on fields or some sort of normalizer? abstraction, I have no idea. Further research required.
Sometimes a data type wants to normalize values for a field, usually so it can accept a broad range of inputs while still preserving meaningful equality semantics. For example, a board game data type may wish to represent the pieces on the board as a
set?
, but allow construction from anysequence?
of pieces. In order to keep equality sensible, at construction time the sequence of pieces should be deduplicated and placed into an unorderedset?
so that the order of the input sequence doesn't affect whether two boards areequal?
.It would be handy to have some integration with
rebellion/type
for this kind of thing. Whether that means a#:normalizer
keyword on fields or some sort ofnormalizer?
abstraction, I have no idea. Further research required.