flock and sockets

Simon Marlow simonmar@microsoft.com
Wed, 19 Mar 2003 16:34:50 -0000


> I am planning a Haskell project and I need to access files. Since the
> program will be automatically started whenever a mail comes=20
> in I will need
> to be able to lock the access to files. Is there any support=20
> for this in some library?

Yes, the Posix library distributed with GHC has support for file
locking.  See

  http://www.haskell.org/ghc/docs/latest/html/hslibs/sec-posix.html

This library is currently undergoing a rewrite - the functionality will
be available under System.Posix in future releases of GHC (and possibly
Hugs & NHC).

> The second option that I have is to use a daemon and let the=20
> programs that
> get started by mail connect via some sort of socket. Is there=20
> any socket support in Haskell?

Yes:

  http://www.haskell.org/ghc/docs/latest/html/network/index.html

(currently only available with GHC).

Cheers,
	Simon