processRequest :: (Proxy p) => () -> Pipe (MaybeP p) String (Either ClientDirective CommandObj) IO ()
processRequest () = forever $ do
  let logmsg = respond . Left . ClientLog "processRequest"
  logmsg "Waiting for requests"
  line <- request ()
  logmsg "Received request"
  case readMaybe line of
   Just (SrvCommand cmd ghcOpts) -> respond $ Right (cmd, ghcOpts)
   Just SrvStatus -> do
     respond $ Left $ ClientStdout "Server is running"
     respond $ Left $ ClientExit ExitSuccess
   Just SrvExit -> do
     respond $ Left $ ClientLog "processRequest" "Shutting server down"
     respond $ Left $ ClientExit ExitSuccess
     nothing
   Nothing ->
     respond $ Left $ ClientUnexpectedError $ "The client sent an invalid message to the server: " ++ line
processRequest :: (Proxy p) => () -> Pipe (MaybeP p) String (Either ClientDirective CommandObj) IO ()
processRequest () = forever $ do
  let logmsg = respond . Left . ClientLog "processRequest"
  logmsg "Waiting for requests"
  line <- request ()
  logmsg "Received request"
  case readMaybe line of
   Just (SrvCommand cmd ghcOpts) -> respond $ Right (cmd, ghcOpts)
   Just SrvStatus -> do
     respond $ Left $ ClientStdout "Server is running"
     respond $ Left $ ClientExit ExitSuccess
   Just SrvExit -> do
     respond $ Left $ ClientLog "processRequest" "Shutting server down"
     respond $ Left $ ClientExit ExitSuccess
     nothing
   Nothing ->
     respond $ Left $ ClientUnexpectedError $ "The client sent an invalid message to the server: " ++ line
processRequest () = forever $ do
  let logmsg = respond . Left . ClientLog "processRequest"
  logmsg "Waiting for requests"
  line <- request ()
  logmsg "Received request"
  case readMaybe line of
   Just (SrvCommand cmd ghcOpts) -> respond $ Right (cmd, ghcOpts)
   Just SrvStatus -> do
     respond $ Left $ ClientStdout "Server is running"
     respond $ Left $ ClientExit ExitSuccess
   Just SrvExit -> do
     respond $ Left $ ClientLog "processRequest" "Shutting server down"
     respond $ Left $ ClientExit ExitSuccess
     nothing
   Nothing ->
     respond $ Left $ ClientUnexpectedError $ "The client sent an invalid message to the server: " ++ line