我如何使有条件的目标成为众多目标中的任何一个?搜索任何字符串列表,而不只是一个字符串?在Haskell

dig*_*git 0 haskell

在:

eval x | "?" `isSuffixOf` x = privmsg (if "what" `isPrefixOf` x then "that would be an ecumenical matter" else "yes")
Run Code Online (Sandbox Code Playgroud)

我怎样才能使“什么”成为“什么”,“谁”,“如何”,“为什么”,“在哪里”,“何时”?

我知道不是。这样^,也不是

eval x | "?" `isSuffixOf` x = privmsg (if "what" "who" "how" "why" "where" "when" `isInfixOf` x then "that would be an ecumenical matter" else "yes")
Run Code Online (Sandbox Code Playgroud)

但是我不确定遇到任何语法失败的逻辑,因此我尝试的所有其他操作都是在黑暗中出现的类似刺伤,包括搜索。

(而且,与“如何使有条件的目标成为众多目标中的任何一个?”相比,我如何更好地表达这个问题?)搜索字词?)

ram*_*ion 6

您要any

interrogatives = ["what", "who", "how", "why", "where", "when"]

eval x | "?" `isSuffixOf` x = privmsg (
  if any (`isInfixOf` x) interrogatives 
     then "that would be an ecumenical matter" 
     else "yes"
  )
Run Code Online (Sandbox Code Playgroud)