Bob is a lackadaisical teenager. He likes to think that he's very cool. And he definitely doesn't get excited about things. That wouldn't be cool.
When people talk to him, his responses are pretty limited.
Your task is to determine what Bob will reply to someone when they say something to him or ask him a question.
Bob only ever answers one of five things:
You need to implement the
responseFor function that returns Bob's response
for a given input. You can use the provided signature if you are unsure
about the types, but don't let it restrict your creativity:
responseFor :: String -> String
To solve this exercise you may read up on:
This exercise works with textual data. For historical reasons, Haskell's
String type is synonymous with
[Char], a list of characters. For more
efficient handling of textual data, the
Text type can be used.
As an optional extension to this exercise, you can
Read about string types in Haskell.
- text to your list of dependencies in package.yaml.
Data.Text in the following way:
import qualified Data.Text as T import Data.Text (Text)
You can now write e.g.
responseFor :: Text -> Text and refer to
Data.Text combinators as e.g.
Look up the documentation for
You can then replace all occurrences of
Text in Bob.hs:
responseFor :: Text -> Text
This part is entirely optional.