You can define a function for this using pattern matching:
getIntegerFromA :: A -> Integer
getIntegerFromA (B _ int) = int
Although depending on where you want to use it, you can probably get the value using a template that fits right there, instead of defining a separate function.
source
share