Compile-Time Checked Truth Tables
Somewhat surprised that the author doesn&#x27;t go on to show how to reduce the truth table...<p><pre><code>    let decide requiresApproval canUserApprove itemStatus =
        match requiresApproval, canUserApprove, itemStatus with
        |  true,  true, NotAvailable -&gt; Hidden
        | false,  true, NotAvailable -&gt; Hidden
        |  true, false, NotAvailable -&gt; Hidden
        | false, false, NotAvailable -&gt; Hidden
        |  true,  true,    Available -&gt; ReadWrite
        | false,  true,    Available -&gt; Hidden
        |  true, false,    Available -&gt; ReadOnly
        | false, false,    Available -&gt; Hidden
        |  true,  true,        InUse -&gt; ReadOnly
        | false,  true,        InUse -&gt; Hidden
        |  true, false,        InUse -&gt; ReadOnly
        | false, false,        InUse -&gt; Hidden
</code></pre>
...to something like this:<p><pre><code>    let decide requiresApproval canUserApprove itemStatus =
        match requiresApproval, canUserApprove, itemStatus with
        |     _,     _, NotAvailable -&gt; Hidden
        | false,     _,            _ -&gt; Hidden
        |  true,  true,    Available -&gt; ReadWrite
        |  true,     _,            _ -&gt; ReadOnly
</code></pre>
I would think that being able to see and effect this reduction is part of the benefit of writing out the whole table. It might not always be the right call to actually reduce it, but in this case (based on the parameter names) each of the branches seems to makes sense from a domain perspective, so why not do it?