úÎPMÌ"      ! Safe-InferredBWhere 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. 6Kill a process and wait for it to release its pidfile Send %/ to the process recorded in the pidfile. This  immediately kills the process. &<Send a signal to a process whose pid is recorded in a file. pidfile  redirection program &'&'None.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.      None De-serialize data from strict ( s. Uses cereal's  incremental  parser. Serialize data into strict (s.     None<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. None The location of the daemon' s pidfile. ,The configuration options of a daemon. See   for a description of each. Simple wrapper around  which uses 3 a 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, don't do ! anything. Returns immediately.  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. ?Start the given handler in the foreground. It will listen and & respond to events on the given port. This is the function that  runs on  the daemon thread. 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 !*+ ! !  !*+,      !"#$%&'()*+,-./0./123456789:;< daemons-0.2.1System.Posix.DaemonControl.Pipe.SocketControl.Pipe.SerializeControl.Pipe.C3 System.DaemonData.SerializeGet RedirectionToFileDevNull runDetached isRunningkill killAndWait brutalKillHandler socketReader socketWriterrunSocketServerrunSocketClient deserializer serializer commandSendercommandReceiverPidFileInHome DaemonOptions daemonPort daemonPidFileprintOnDaemonStartedHostNamePortensureDaemonRunningensureDaemonWithHandlerRunningrunInForeground runClientrunClientWithHandlerbindPort getSocketdata-default-class-0.0.1Data.Default.Classdefghc-prim GHC.TypesTrue unix-2.6.0.1System.Posix.SignalssigQUITsigKILLsignalProcessByFilePath$fDefaultRedirectionbytestring-0.10.0.2Data.ByteString.Internal ByteStringbase Data.MaybeNothing$fIsStringPidFile$fDefaultDaemonOptions