úÎKI      Safe-InferedBWhere should the output (and input) of a daemon be redirected to?  (we can';t just leave it to the current terminal, because it may be * closed, and that would kill the daemon). When in doubt, just use , the default value. ' causes the output to be redirected to /dev/null. This - is safe and is what you want in most cases.  If you don',t want to lose the output (maybe because you' re using it  for logging), use  , instead. >Run the given action detached from the current terminal; this 9 creates an entirely new process. This function returns ? immediately. Uses the double-fork technique to create a well  behaved daemon. If pidfile is given, check/write it; if we D cannot obtain a lock on the file, another process is already using  it, so fail. The  redirection$ parameter controls what to do with  the standard channels (stdin, stderr, and stdout). See:  ,http://www.enderunix.org/docs/eng/daemon.php ?Note: All unnecessary fds should be close before calling this.  Otherwise, you get an fd leak. Return  3 if the given file is locked by a process. In our  case, returns  0 when the daemon that created the file is still  alive. Send !/ to the process recorded in the pidfile. This . gives the process a chance to close cleanly. Send "/ to the process recorded in the pidfile. This  immediately kills the process. pidfile  redirection program ## Safe-Infered.A simple handler: takes an incoming stream of $s, an  stream of $#s, and ties them together somehow. - Conceptually, the simplest handler would be identity:   import Control.Monad  import Control.Pipe  import Data.ByteString.Char8   handler reader writer = do ! let identity = forever $ do  x <- await  yield x . runPipe (writer <+< identity <+< reader) See the pipes. tutorial for more examples of writing pipes. Since $0s are fairly boring by themseleves, have a look  at Control.Pipe.Serialize which lets you deserialize/ serialize  pipes of $ s easily. Stream data from the socket. Stream data to the socket. 4Listen for connections on the given socket, and run  on C each received connection. The socket should previously have been ? bound to a port or to a file. Each handler is run in its own 0 thread. Even in case of an error, the handlers' sockets are  closed. Run  on the given socket.       Safe-Infered De-serialize data from strict $ s. Uses cereal's  incremental  parser. Serialize data into strict $s.      Safe-Infered<Send a single command over the outgoing pipe and wait for a = response. If the incoming pipe is closed before a response  arrives, returns Nothing. BWait for commands on the incoming pipe, handle them, and send the " reponses over the outgoing pipe.  Safe-InferedThe location of the daemon' s pidfile. ,The configuration options of a daemon. See  for a  description of each. Simple wrapper around  which uses a 1 simple function to respond to commands and doesn't deal with pipes. The handler7 is just a function that takes a command and returns a  response. BStart a daemon running on the given port, using the given handler ? to respond to events. If the daemon is already running, just  return.  The pidfile PidFile options# will be created and locked. This = function checks the pidfile to see if the daemon is already  running. BThe daemon will listen for incoming connections on all interfaces  on daemonPort options. The handler0 is a function that takes the reader and writer   ByteString* pipes and does something with them. See   for an example handler. BSend a command to the daemon running at the given network address  and wait for a response.  This is a simple wrapper around  that sends a 1 single command and waits for a single response. @If the connection is closed before receiving a response, return  %. @Connect to the given network address and run the handler on the ( reader and wrier pipes for the socket. The handler0 is a function that takes the reader and writer   ByteString5 pipes and does something with them. For an example  handler, see (, which sends a command and waits for a  response. /Create a socket and bind it to the given port. 8Create a socket connected to the given network address. name options handler name options handler  hostname port command  hostname port command &' &'(      !"#$%&'()*+,-+,./012345678 daemons-0.1.1System.Posix.DaemonControl.Pipe.SocketControl.Pipe.SerializeControl.Pipe.C3 System.DaemonData.SerializeGet RedirectionToFileDevNull runDetached isRunningkill brutalKillHandler socketReader socketWriterrunSocketServerrunSocketClient deserializer serializer commandSendercommandReceiverPidFileInHome DaemonOptions daemonPort daemonPidFileHostNamePort startDaemonstartDaemonWithHandler runClientrunClientWithHandlerbindPort getSocketdata-default-0.5.0 Data.Defaultdefghc-prim GHC.TypesTrue unix-2.5.1.0System.Posix.SignalssigQUITsigKILL$fDefaultRedirectionbytestring-0.9.2.1Data.ByteString.Internal ByteStringbase Data.MaybeNothing$fIsStringPidFile$fDefaultDaemonOptions