[MLton] Bug: TextPrimIO does not distinguish between EOF and no data

Vesa Karvonen vesa.a.j.k at gmail.com
Wed Dec 12 13:00:24 PST 2007


On Dec 11, 2007 2:17 PM, Ville Laurikari <ville at laurikari.net> wrote:
[...]
> I dug around a bit, and found out that it seems that a readArrNB made
> with PrimIO (in basis-library/io/prim-io.fun) never returns NONE (to
> signify no data), but always returns SOME _.  In case of no data, we
> get SOME 0 which means EOF.  This readArrNB is implemented as
>    SOME (SOME o (readArr "readVecNB"))
> Am I just confused or is this the problem?  If the primitive reader
> does not distinguish between EOF and no data, TextIO surely cannot
> either.

Just a quick note.  You seem to be looking at the wrong place.  If you
install the def-use-mode (http://mlton.org/EmacsDefUseMode), compile
the program as

  mlton -prefer-abs-paths true -show-def-use bug.du bug.sml

and add the bug.du (M-x esml-du-mlton bug.du) to def-use mode, you can
then use the def-use mode to browse the code.  If you put the cursor
on the TextIO.stdIn symbol (in bug.sml), you can quickly follow the
code to the point where you'll find the readArrNB implementation
(stdIn -> newIn -> newIn -> mkReader -> mkTextReader -> make ->
mkReader).

-Vesa Karvonen



More information about the MLton mailing list