[MLton] funny error message
Andreas Rossberg
rossberg@ps.uni-sb.de
Fri, 23 Sep 2005 10:59:36 +0200
Henry Cejtin wrote:
> I am trying to convert some old SML (1990) code to SML 1997, and MLton is
> printing the following error out:
> Variable type in structure disagrees with signature.
> variable: flatten
> structure: ['a] stream stream -> ['a] stream
> signature: ['b] stream stream -> ['b] stream
> As near as I can tell, 'a and 'b are both free. Am I confused or is this
> error message bad?
This is most likely caused by the value restriction, which wasn't yet
present in today's form in SML 90. That is, the definition of `flatten'
in the structure is no longer polymorphic according to the new rules.
Usually, eta-expansion is sufficient to work around this (it is likely
that the old code implements `flatten' by partial application of
something like fold - just turn it into a fun declaration).
--
Andreas Rossberg, rossberg@ps.uni-sb.de
Let's get rid of those possible thingies! -- TB