[MLton] Specification of scan in STRING

Matthew Fluet fluet at tti-c.org
Mon Mar 5 08:22:10 PST 2007


Vesa Karvonen wrote:
> I noticed that the specification of scan in the MLton Basis library implementation
> of the STRING signature is
> 
> val scan: (Char.char, 'a) StringCvt.reader -> (string, 'a) StringCvt.reader
>            ^^^^^^^^^
> 
> while the Basis spec says that it should be
> 
> val scan : (char, 'a) StringCvt.reader -> (string, 'a) StringCvt.reader
>             ^^^^
> 
> Which one needs to be fixed?

When Wesley submitted the WideChar patch, we noted the discrepancy:
   http://mlton.org/pipermail/mlton/2007-February/029579.html

Our conclusion is that the Basis spec is incorrect here, since every 
'scan' function in the Basis Library is in terms of Char.char (many 
times via the top-level 'char' type).  In particular, in the CHAR 
signature, which has a local 'char' type, the 'scan' function is in 
terms of Char.char.  And, although the Basis specification notes that 
STRING.scan cannot be implemented as a simple iterative application of 
CHAR.scan, the implication is that STRING.scan and CHAR.scan are closely 
related.




More information about the MLton mailing list