Combine pattern synonyms and record wild cards

12 Sep
2022
12 Sep
'22
4:33 a.m.
Hello all, I'm playing with pattern synonyms to create a more intuitive API. Essentially what I would like is to allow a record wild card through a pattern synonym. Allow me to illustrate with an example. I have a data type. `data Foo a = Foo { unFoo :: a }` and a type `FooMaybe a = Maybe (Foo a)`. Now I have a pattern synonym `pattern FooJust x = Just (Foo x)`. This works and I can match on it no problem. But by doing this I lose the ability to use RecordWildCards. I can do this `myFun (Just Foo{..}) but not this `myFun FooJust{..}`. Is there some way to use pattern synonym while preserving the ability of using record wild cards? Best regards, Rowan Goemans
981
Age (days ago)
981
Last active (days ago)
0 comments
1 participants
participants (1)
-
rowan goemans