Using
type ('a, 'b) t = | Ok of 'a | Error of 'b
gives two annoying alternatives:
Core_kernel
's Result.t
, orCore_kernel
.Type equality constraints do not work twice. I.e. one cannot write:
type ('a, 'b) result_core = ('a, 'b) Result.t = Ok of 'a | Error of 'b type ('a, 'b) result_err = ('a, 'b) Err.t = Ok of 'a | Error of 'b type ('a, 'b) result = ('a, 'b) result_err = ('a, 'b) result_core
Polymorphic Variants are safe while not enforcing library dependencies.
The following libraries use “regular/ordinary” variants and hence are all incompatible from each other:
Core.Std.Result
BatResult