Upcoming breaking change in Base/Core v0.14

We’re changing functions in Base that used to use the polymorphic
variant type [ `Fst of 'a | `Snd of 'b ] to use ('a, 'b) Either.t
instead. As well as enabling the use of all of the functions in the
Either module, this makes the functions consistent with other
functions that already use Either.t, (currently just
Set.symmetric_diff).

The following functions’ types will change:

  • Result.ok_fst
  • List.partition_map
  • Map.partition_map, Map.partition_mapi
  • Hashtbl.partition_map, Hashtbl.partition_mapi

The type of List.partition3_map will not change:

val partition3_map
  :  'a t
  -> f:('a -> [ `Fst of 'b | `Snd of 'c | `Trd of 'd ])
  -> 'b t * 'c t * 'd t

We don’t have a generic ternary variant, and it doesn’t seem worth it
to mint one just for this purpose.

Since this change is pretty straightforward, we expect that a simple find/replace will be sufficient to update any affected call sites.

4 Likes

Good work. The less polymorphic variants, the better.

1 Like

Thanks for the advance warning!

(I remember wondering a few months ago why Either didn’t get any use in this use case, so this is pretty awesome to see.)