f :: Foo -> Bool
f (Foo n)
| even n = True
| odd n = False
f (Bar n)
| even n = True
| odd n = False
(1) Since even is monomorphized to Int -> Bool, you can just write
f (Foo n) = even n f (Bar n) = even n
(2) Since the sum subtypes are the same, you can write
data Foo = Foo {myN :: Int} | Bar {myN :: Int}
f :: Foo -> Bool f x = even $ myN x
(3) As to your original question why the underscore _ can't be overloaded for this, I dunno. It /may/ be possible. Seems rare in practice. You could always apply the type isomorphism to get