Sha256: 5714331fb72195354a861e642d5466c410487458f23898f18bc320e3d84e8c7e
Contents?: true
Size: 583 Bytes
Versions: 293
Compression:
Stored size: 583 Bytes
Contents
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
Version data entries
293 entries across 293 versions & 1 rubygems