Or better, use Elm (or something similar) and tagged unions. That way you get type-checking and exhaustive-checking of your message types. You still have a big match (~switch&#x2F;case) but now the compiler yells at you if you&#x27;ve forgotten to handle a message tag or if you&#x27;re not unpacking the right types from it.