[ Non-Hugs-specific stuff follows ... ]

Apart from the fact that Hugs98 still doesn't implement hSeek,
there seems to be some argument confusion:

-- iomonad.c ---------------------------------------------------------
[...]
primFun(primHSetPosn) {
#if HAVE_FSETPOS
    fpos_t pos = 0;
#elif HAVE_FSEEK
    long   pos = 0;
#endif
    Int    h;
    HandleArg(h,3);
    IntArg(pos,4);
[...]
----------------------------------------------------------------------

This probably corresponds to

   hSetPosn :: Handle -> HandlePosn -> IO ()

and not the required

   hSetPosn :: HandlePosn -> IO ()

Consequently, I always get an "Illegal operation" here.

This bug leads to something in the Haskell 98 library report I
haven't really understood yet (section 11.5):

   * Why are there *two* ways to reposition a handle (one via
     hSeek and the other one via hSetPosn)?

   * Where is hTell?

   * Why is the handle supposed to be contained in HandlePosn?
     This way one can't keep "a finger" within a file without keeping
     it open. Yes, I know that the file can change in the meantime,
     but this is not under Haskell's control, anyway.

Because it's already too late for Haskell 98, I propose the following
for Haskell 2000:

Keep hSeek as it is, remove HandlePosn/hGetPosn/hSetPosn and add

   hTell :: Handle -> IO Integer

Rationale: Keeping a file position opaque is a bad idea, because
*lots* of file formats rely on the fact that arithmetic is possible
on file positions, see e.g. http://www.wotsit.org/. Merging a file
position with a handle is even worse, because this keeps the file
open even when only the position is needed later.

Opinions?

Cheers,
   Sven
-- 
Sven Panne                                        Tel.: +49/89/2178-2235
LMU, Institut fuer Informatik                     FAX : +49/89/2178-2211
LFE Programmier- und Modellierungssprachen              Oettingenstr. 67
mailto:[EMAIL PROTECTED]            D-80538 Muenchen
http://www.informatik.uni-muenchen.de/~Sven.Panne


Reply via email to