receiveMessage :: Alonzo a Message
receiveMessage = do
  s <- lift receive
  case decode s of
    Nothing -> logError ("Parsing of " ++ show s ++ " failed!") >> receiveMessage
    Just Message {msg_command = "PING", msg_params = servers} -> sendMessage (pong servers) >> receiveMessage
    Just m -> return m
receiveMessage :: Alonzo a Message
receiveMessage = do
  s <- lift receive
  case decode s of
    Nothing -> logError ("Parsing of " ++ show s ++ " failed!") >> receiveMessage
    Just Message {msg_command = "PING", msg_params = servers} -> sendMessage (pong servers) >> receiveMessage
    Just m -> return m
receiveMessage = do
  s <- lift receive
  case decode s of
    Nothing -> logError ("Parsing of " ++ show s ++ " failed!") >> receiveMessage
    Just Message {msg_command = "PING", msg_params = servers} -> sendMessage (pong servers) >> receiveMessage
    Just m -> return m