Sometimes query parameters are optional. You may have noticed that the
RqData module does not seem to provide any functions for
dealing with optional values. That is because we can just use the Alternative class from Control.Applicative which provides the function optional for us:
Here is a simple example where the greeting parameter is optional:
[Source code for the app is here.]
If we visit http://localhost:8000/?greeting=hello, we will get Just "hello".
if we leave off the query parameters we get http://localhost:8000/, we will get Nothing.