module Bob (responseFor) where import Data.Char ( isLetter, isSpace, isUpper ) responseFor :: String -> String responseFor input | null text = "Na gut. Dann eben nicht!" | isShouting && isAsking = "Chill mal, ich bin da schon dran!" | isShouting = "Whoa, entspann dich!" | isAsking = "Klar." | otherwise = "Whatever." where text = filter (not . isSpace) input letters = filter isLetter text isShouting = all isUpper letters && any isUpper letters isAsking = last text == '?'