Assume that we have next data:
data Value =
IntVal Int
| BoolVal Bool
and function
f :: Value -> Int
How can I separate cases on different constructors on argument of type Value?
So f (IntVal 1) has one behaviour and f (BoolVal True) has some another behaviour.
There are a few different methods a popular one is to use pattern matching in a function parameter.
Another method would be to use case patterns.
Using case: