
Hi all, I worked for a bit while I was on vacation on a haskell interface to libfuse, which I thought some of you might find interesting. It is VERY much a halted-work-in-progress, as I didn't get very far, and don't have time to continue work on it. You can get what there is with darcs get http://abridgegame.org/repos/fuse_example or browse at http://abridgegame.org/cgi-bin/darcs.cgi/fuse_example It's basically an attempt at combining a nice DarcsIO-style filesystem interface on the haskell side (called FuseIO) with an interface to libfuse (which is a library for creating filesystems from user space on linux). The main file is (quite confusingly) called hello.hs, and you can see that it basically just imports one function from FuseIO and one from Fuse. It tries to do the equivalent of `mount --bind dir1 dir2`, execpt that there's no support for writing to files, or in general modifying the mounted filesystem. I had been thinking (although I now have no time for this) about the possibility of implementing a caching distributed network filesystem which had git as its backend. Of course, I'd start with just a local filesystem with git as the backend, which would be a bit stupid, although it'd have the (very minor) advantage that identical files would be effectively hard-linked as far as space use goes. The FuseIO module itself might be rather interesting for other projects (e.g. darcs), or even (one could imagine) as an alternative to the haskell standard IO libraries for filesystem access, since it'd allow you to write a function that is guaranteed by the typesystem to do nothing but read from a filesystem, and it'd also allow writing polymorphic filesystem access/modification code that could be applied outside the IO monad (e.g. to Slurpies). It would also allow one to use treat network objects (e.g. http or ftp) as filesystems. The Fuse side of things uses hsffig to generate an interface to libfuse, and then translates the libfuse interface into FuseIO commands, so implementing a new sort of filesystem (e.g. sshfs) would require modifying neither FuseIO nor Fuse, but instead just implementing a new FS and plugging it in. But the Fuse interface is very limited, as is the FuseIO interface (which doesn't support, for example, file permissions), so to make a real useful filesystem would require considerable extension of both modules. -- David Roundy http://www.darcs.net

See also Jeremy Bobbio's fuse bindings here:
http://cvs.haskell.org/darcs/hfuse/
I've been using them on the Halfs, the Haskell Filesystem that I'll be
demoing at the Haskell Workshop.
David Roundy
The FuseIO module itself might be rather interesting for other projects (e.g. darcs), or even (one could imagine) as an alternative to the haskell standard IO libraries for filesystem access, since it'd allow you to write a function that is guaranteed by the typesystem to do nothing but read from a filesystem, and it'd also allow writing polymorphic filesystem access/modification code that could be applied outside the IO monad (e.g. to Slurpies). It would also allow one to use treat network objects (e.g. http or ftp) as filesystems.
I haven't gotten a chance to really look at this yet, but it sounds really cool. peace, isaac
participants (2)
-
David Roundy
-
Isaac Jones