Ian Zimmerman wrote:
For the last 4 hours or so, I have been trying to compile the enclosed fragment of SML/NJ Util library with Poly/ML 5.1. I can't understand why it behaves this way:
use "bit-vector2.sml";
Error: in 'bit-vector2.sml', line 1. Can't match BitVector.vector to {} (Incompatible types) While checking (update) near structure BitVector :> BIT_VECTOR = struct local structure W8A = Word8Array; structure W8V = Word8Vector; val ...; ...; ... in type elem = bool; val ... = ...; datatype ...; ...; ... end end
Is poly trying to unify BitVector.vector with a record type? Why?
The problem, simply, is that your "update" function is returning "unit" but your signature wants it to return a BIT_VECTOR.vector. In Standard ML the type 'unit' is defined as the empty record '{}'; see the Definition of Standard ML, page 67. The message says 'While checking (update)' so it is telling you that it is in the signature matching for the value 'update'. It's all in the error message.
David.