Hello there,
I’d like to ask whether it is somehow possible to write pattern match (in case
in this example) with multiple occurrences of single variable “placeholder”. By this I would be able to “constraint” case
d expression even more…
Like so:
case ( cookie.selectedCategoryId, c.id ) of
( Just selectedId, selectedId ) ->
"It equals!"
(_, _ ) ->
"It does not equal or 1st item of tuple is Noothing"
In this example I would like to check that cookie.selectedId
is Just a
and a
equals to c.id
But it produces following error:
-- NAME CLASH --------------- C:\....\Main.elm
This `case` pattern has multiple `selectedId` variables.
651| ( Just selectedId, selectedId ) ->
^^^^^^^^^^
How can I know which one you want? Rename one of them!
Should it be possible to write something like that or shall I figure it out using additional if
?