Hi,
I would like to define a pattern synonym for a sum type to extract 1 field from both data constructors.
Looks like doable but GHC cannot compile following snippet:
data FooBar = Foo Int String | Bar String
pattern FooBarStr :: String → Foo
pattern FooBarStr s ← Foo _ s
pattern FooBarStr s ← Bar s
Originally Foo type was defined as:
data Foo = Foo (Maybe Int) String
But I have a problem with using a generated prism
( _Foo # Nothing ) – is not the same as _Bar of FooBar