title: SML Case and pattern matching
body: <p>I have the follwing function that is suppose to return the value of a card. I'm not sure why the case Num => Num is giving the following error:</p>
  
  <blockquote>
    <p>Error: Types of rules don't agree, Earlier rules rank->int this rule
    rank->int->rank</p>
  </blockquote>
  
  <p>Why would Num=>Num have the return type rank->int->rank</p>
  
  <pre><code> datatype suit = Clubs | Diamonds | Hearts | Spades
   datatype rank = Jack | Queen | King | Ace | Num of int 
   type card = suit * rank
  
  
   fun card_value (suit, rank)=
   case rank of
      Ace =&gt;11
       | Jack =&gt;10
       | King =&gt;10
       | Queen =&gt;10
       | Num =&gt; Num ;
  
  
  card_value(Clubs,Ace); //calling function
  </code></pre>