'How to check if list contains discriminated union case with type?

Given the follwing code:

type Creature = 
    { Strength: int 
      Toughness: int }

type CardType = 
    | Creature of Creature
    | Land 
    | Instant

type Card = 
    { Types: CardType list }
module Card = 
    let isType t card = List.contains t card.Types


I am able to write

Card.isType Land

When trying to check if card is a creature, i get the following error:

This expression was expected to have type
    'CardType'    
but here has type
    'Creature -> CardType'

Is it even possible to have a "isType" function like this or am I stuck with pattern matching on a separate "isCreature" function instead?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source