unix package

Bulat Ziganshin bulat.ziganshin at gmail.com
Sun Jul 1 09:34:27 EDT 2007


Hello Duncan,

Saturday, June 30, 2007, 8:17:05 PM, you wrote:

> Yes. I've got a little Gtk2Hs demo that shows you a directory tree with
> file names and file sizes. With the portable Haskell directory stuff I
> can't even get the file size, I'd have to open every file and use
> hFileSize.

getFileSize isn't any harder to implement than getModificationTime,
the only minoor problem is that function used (lstat) will truncate
file size to low 32 bits, for full 64-bit value non-portable lstati64
should be used instead (and another type for C-level filesize too)

> Perhaps with splitting the base package up we have the opportunity to
> have the directory & IO stuff live in a package that can depend on
> either the posix/unix or win32 packages, and implement the portable IO
> stuff on top of those (probably still using cpp). 

anyway file operations best should be split away from base. the
only problem is that Handle type used in definition of Exception which
is used in definition of IO monad which is used in Prelude (and some
Prelude functions need file i/o by itself)

i once proposed plan of implementing stack of file system/io libraries
http://haskell.org/haskellwiki/Library/IO , also portable base for file i/o
and memory-mapped files i/o implemented in Streams library: see
System.FD and System.MMFile modules in
http://www.haskell.org/library/StreamsBeta.tar.gz 


-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com



More information about the Libraries mailing list