module Bob (responseFor) where
import Data.Char (isSpace, isUpper, isAlpha)

data Prompt = Silence | Yell | Question | Other

classify :: String -> Prompt
classify s | all isSpace s = Silence
           | any isAlpha s && (all isUpper $ filter isAlpha s) = Yell
           | '?' == last (filter (not . isSpace) s) = Question
           | otherwise = Other

response :: Prompt -> String
response Silence = "Fine. Be that way!"
response Yell = "Whoa, chill out!"
response Question = "Sure."
response Other = "Whatever."

responseFor :: String -> String
responseFor = response . classify

module Bob (responseFor) where
import Data.Char (isSpace, isUpper, isAlpha)

data Prompt = Silence | Yell | Question | Other

classify :: String -> Prompt
classify s | all isSpace s = Silence
           | any isAlpha s && all isUpper (filter isAlpha s) = Yell
           | '?' == last (filter (not . isSpace) s) = Question
           | otherwise = Other

response :: Prompt -> String
response Silence = "Fine. Be that way!"
response Yell = "Whoa, chill out!"
response Question = "Sure."
response Other = "Whatever."

responseFor :: String -> String
responseFor = response . classify

Improve code based on HLint's suggestions.
bob: Improve code based on HLint's suggestions.
