Can I somehow make a query parser fail instead of returning maybes like it does for path segments?
type Route
= VerifyEmail String
routeParser : Parser (Maybe Route -> a) a
routeParser =
let
toRoute mode oobCode =
case mode of
"verifyEmail" ->
Just <| VerifyEmail oobCode
_ ->
Nothing
in
Parser.top
<?> Query.map2 (Maybe.map2 toRoute) (Query.string "mode") (Query.string "oobCode")
|> Parser.map (Maybe.andThen identity)
Something that would turn
routeParser : Parser (Maybe Route -> a) a
into
routeParser : Parser (Route -> a) a
It seems Parser.Query.string
should be called Parser.Query.maybeString
if the presence of the query param is optional?