Is it possible to pass the type of a discriminated union tag to another function so it can use it for pattern matching?
Non working example of what I mean:
This does not answer your question directly but suggests an alternative way to achieve what you want.
You could filter your list using the existing high order function List.filter and pattern matching:
let pigs = animals |> List.filter (function |Pig(_)-> true |_->false )
I think this is a more idiomatic approach: you filter your list using a pattern, in this case you filter your animals keeping only those who satisfy the pattern Pig(_).