Here's an example: pattern State :: (s -> (a, s)) -> State s a pattern State f <- (coerce . runStateT -> f) where State = state
This would be very nice to bundle with the State type synonym. On Thu, Sep 16, 2021, 2:22 PM Carter Schonwald <carter.schonw...@gmail.com> wrote: > These are great ideas! Could you please create a ghc tracker ticket with a > tiny examples or two? > > There may be specific technical reasons we might not be able to do so for > type synonyms in ghc, but I don’t see any obvious barriers in the case of > David’s excellent idea, I’ve def seen lots of great code out there where > you’d really want either associated pattern synonyms or to bundle pattern > synonyms with the exported public interface for a type class. > > I’m sure there’s some devil in the details but these sound lovely. Step > -1 is making up 1-2 toy examples and explaining what and why you want it on > a ghc ticket! > > On Wed, Sep 8, 2021 at 1:25 PM David Feuer <david.fe...@gmail.com> wrote: > >> I would like that, along with the ability to bundle patterns with classes. >> >> On Wed, Sep 8, 2021, 1:13 PM Keith <keith.wyg...@gmail.com> wrote: >> >>> Is there currently a way to 'bundle' a pattern with a type alias? And if >>> not, could that capability be added to the PatternSynonyms GHC extension? >>> (Is this the right place to ask, or should I be asking a GHC list?) >>> >>> --Keith >>> Sent from my phone with K-9 Mail. >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> To (un)subscribe, modify options or view archives go to: >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>> Only members subscribed via the mailman list are allowed to post. >> >> _______________________________________________ >> Haskell-Cafe mailing list >> To (un)subscribe, modify options or view archives go to: >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> Only members subscribed via the mailman list are allowed to post. > >
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users