Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Generative functors are allowed to be applicative ! #7611
Original bug ID: 7611
in type expression, it is possible to use generative functors as applicative:
module F () = struct type t end
Even if safe, I would expect the above program to be rejected !
Comment author: @garrigue
Thanks for the report.
Indeed, there is no soundness problem here, since what this code says is just that "if there were values of type F(List).t, then we would be able to compare them". However, the code for generative functor does not allow to create values of this type.
A more correct statement would be "generative functors can be used as applicative constructors in type paths".
I agree that allowing to write this meaningless type is confusing, and this should be eventually rejected.
Comment author: @lpw25
Well, you can actually create values of some of these nonsense types:
module F () = struct
let x : F(List).t = T;;
but I think it is still not enough to break soundness.