parseInput :: B.ByteString -> IO(Maybe KVRequest)
parseInput text = do

  let pieces = C8.split ' ' text
  if Prelude.length pieces > 1
  then let reqType = Prelude.head pieces
           key = pieces !! 1
           val | Prelude.length pieces >= 3 = pieces !! 2
               | otherwise = B.empty

          in return $ case reqType of
                        "PUT" -> Just $ PutReq 0 key val
                        "GET" -> Just $ GetReq 0 key
                        "DEL" -> Just $ DelReq 0 key   
                        _     -> Nothing        
  else return Nothing
parseInput :: B.ByteString -> IO(Maybe KVRequest)
parseInput text = do

  let pieces = C8.split ' ' text
  if Prelude.length pieces > 1
  then let reqType = Prelude.head pieces
           key = pieces !! 1
           val | Prelude.length pieces >= 3 = pieces !! 2
               | otherwise = B.empty

          in return $ case reqType of
                        "PUT" -> Just $ PutReq 0 key val
                        "GET" -> Just $ GetReq 0 key
                        "DEL" -> Just $ DelReq 0 key   
                        _     -> Nothing        
  else return Nothing
parseInput text = do

  let pieces = C8.split ' ' text
  if Prelude.length pieces > 1
  then let reqType = Prelude.head pieces
           key = pieces !! 1
           val | Prelude.length pieces >= 3 = pieces !! 2
               | otherwise = B.empty

          in return $ case reqType of
                        "PUT" -> Just $ PutReq 0 key val
                        "GET" -> Just $ GetReq 0 key
                        "DEL" -> Just $ DelReq 0 key   
                        _     -> Nothing        
  else return Nothing