Expected bool but has different type
<p>In the following method, I get the following error: <code>error FS0001: This expression was expected to have type bool but here has type Outcome list * ProbTree -&gt; bool</code> when trying to call isSample in the if expression. I have no clue why I get the message.</p>

<p>isSample(os, t) is currently of type <code>'a * 'b -&gt; Outcome list * ProbTree -&gt; bool</code>. Any ideas? What I don't understand is why it expects type <code>bool</code> all of a sudden.</p>

<pre><code>let rec isSample(os, t) = function
| ([], Branch(_, p, b1, b2))                         -&gt; false
| (os, Branch(_, p, b1, b2)) when List.length os = 1 -&gt; true 
| (h::t, Branch(_, p, b1, b2)) -&gt;
    if h = S then isSample(t, b1) else isSample(t, b2) //This is where I get the error
| _ -&gt; false


type Outcome  = | S | F 
type Sample   = Outcome list
type ProbTree = | Branch of string * float * ProbTree * ProbTree
                | Leaf of string
</code></pre>