[MLton] False unused warnings with functors
Vesa Karvonen
vesa.a.j.k at gmail.com
Tue Oct 9 09:20:28 PDT 2007
Consider the following minimal example:
functor Warning (type t val x : t) = struct
val y = x
end
structure X = Warning (type t = int val x = 1)
Compiling the above with -default-ann 'warnUnused true' gives the
following warning:
Warning: /home/vk/work/sml/sandbox/unused-warning.sml 5.29.
Unused type: t.
The problem with the warning here is that the definition is used. It
just isn't explicitly referred to within the body (rhs) of the
functor. It is only used within the argument signature.
I've run into this warning several times earlier. Often subsequent
changes to the code eliminated the warning. Currently some code in my
generics library causes warnings for similar reasons (except that the
definition is a substructure containing types rather than just a
type).
I haven't yet looked at the code (in MLton) to see whether this would
be easy to fix.
-Vesa Karvonen
More information about the MLton
mailing list