Would it be possible to write a function allowing to find, in a List Component, a specific variant, like Name “Yoda”? I imagined a function type like this one, but I have no Idea if the implementation is possible…
You could also write the predicate functions like this:
findName : Component -> Boolean
findName component =
case component of
Name _ ->
True
_ ->
False
And then repeat for every value constructor. I never saw this problem solved any other way. I guess that’s how you solve such things in a statically typed language. Correct me if I’m wrong.