If I write a Functor module, i am thinking of following constraints to implement Alternative type class (like Haskell). In the following snippet, I am showing the way, I’d like to constrain the types being passed to the functor module.
module type K = { type t<'a>; }
module type ALT = { type t<'a>; let alt : t<'a> => t<'a> => t<'a>; }
module ALTERNATIVE = (K: AT, L: ALT with t<'a> = K.t<'a>) => {
}
It seems, it is not possible to add such constraints. Is there any alternative to this?