module type EstablishmentType = {
type profession;
/* This works, but then it's not abstract. */
/*
type profession =
| Teacher
| Director;
*/
let getProfession: profession => string;
};
module School: EstablishmentType = {
/*
type profession = ... is marked with the following warning:
"Warning 37: constructor Director is never used to build values.
(However, this constructor appears in patterns.)"
*/
type profession =
| Teacher
| Director;
let getProfession = person =>
switch (person) {
| Teacher => "A teacher"
| Director => "A director"
};
};
Variant type from abstract module signature gives a warning
mendel
#1
yawaramin
#2
That’s a valid warning. This code is not actually building any values of the type profession
. If you add a build function (or make the type definition public) the warning should go away.