Example:
data A =
A B D
| Aa B C
| Ag B X X
| Ae B R Q
| Ax X
getB a = case a of
(A b _) -> b
(Aa b _) -> b
(Ag b _ _) -> b
(Ae b _ _) -> b
(Ax _) -> somethingElse
In Haskell, given a data type where many of the constructors have the same argument type, is there a better way to return this argument. Or is there a better way to write the case
statement shown above to have less repetition?