Skip to content

Commit

Permalink
repr: derive custom ~pre_hash from ~encode_bin if passed
Browse files Browse the repository at this point in the history
  • Loading branch information
craigfe committed Oct 11, 2021
1 parent 24e93db commit 990f313
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/repr/type.ml
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,12 @@ let like ?pp ?of_string ?json ?bin ?unboxed_bin ?equal ?compare ?short_hash
and unboxed_bin = to_impl unboxed_bin
and compare = to_impl compare
and short_hash = to_impl short_hash
and pre_hash = to_impl pre_hash in
and pre_hash =
match pre_hash with
| Some x -> Custom x
| None -> (
match bin with Some (x, _, _) -> Custom x | None -> Structural)
in
partially_abstract ~pp ~json ~of_string ~bin ~unboxed_bin ~equal ~compare
~short_hash ~pre_hash t

Expand Down

0 comments on commit 990f313

Please sign in to comment.