main = do
  args <- getArgs
  case args of
    [staticPath, sendmail, tokenKey] -> do
      bracket
        (socket AF_UNIX Stream 0)
        (\ sock -> do
            close sock
            try' (removeFile "vocabulink.sock"))
        (\ sock -> do
            bind sock (SockAddrUnix "vocabulink.sock")
            setFileMode "vocabulink.sock" (ownerReadMode .|. ownerWriteMode .|. groupReadMode .|. groupWriteMode .|. otherReadMode .|. otherWriteMode)
            listen sock 1024
            runSettingsSocket (setServerName "" defaultSettings) sock (handleRequest staticPath sendmail tokenKey))
    _ -> do
      progName <- getProgName
      hPutStrLn stderr ("Usage: " ++ progName ++ " static-dir sendmail token-key")
 where try' :: IO a -> IO (Either SomeException a)
       try' = try
main = do
  args <- getArgs
  case args of
    [staticPath, sendmail, tokenKey] -> do
      bracket
        (socket AF_UNIX Stream 0)
        (\ sock -> do
            close sock
            try' (removeFile "vocabulink.sock"))
        (\ sock -> do
            bind sock (SockAddrUnix "vocabulink.sock")
            setFileMode "vocabulink.sock" (ownerReadMode .|. ownerWriteMode .|. groupReadMode .|. groupWriteMode .|. otherReadMode .|. otherWriteMode)
            listen sock 1024
            runSettingsSocket (setServerName "" defaultSettings) sock (handleRequest staticPath sendmail tokenKey))
    _ -> do
      progName <- getProgName
      hPutStrLn stderr ("Usage: " ++ progName ++ " static-dir sendmail token-key")
 where try' :: IO a -> IO (Either SomeException a)
       try' = try
main = do
  args <- getArgs
  case args of
    [staticPath, sendmail, tokenKey] -> do
      bracket
        (socket AF_UNIX Stream 0)
        (\ sock -> do
            close sock
            try' (removeFile "vocabulink.sock"))
        (\ sock -> do
            bind sock (SockAddrUnix "vocabulink.sock")
            setFileMode "vocabulink.sock" (ownerReadMode .|. ownerWriteMode .|. groupReadMode .|. groupWriteMode .|. otherReadMode .|. otherWriteMode)
            listen sock 1024
            runSettingsSocket (setServerName "" defaultSettings) sock (handleRequest staticPath sendmail tokenKey))
    _ -> do
      progName <- getProgName
      hPutStrLn stderr ("Usage: " ++ progName ++ " static-dir sendmail token-key")
 where try' :: IO a -> IO (Either SomeException a)
       try' = try