{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreigavfre2wt5qefkm4sa34256qihuvu2i3y32smgpmdg3ds7asgvoa",
"uri": "at://did:plc:pi6woz4d47bkuws673w2il2r/app.bsky.feed.post/3mn5rdov5wyd2"
},
"path": "/t/pattern-synonyms-and-type-families/14180#post_1",
"publishedAt": "2026-05-31T14:08:45.000Z",
"site": "https://discourse.haskell.org",
"textContent": "Hi,\n\nI tried to use a pattern synonym with a type family and got the following GHC error:\n\n\n Pattern synonym ‘ZeroAB’ cannot be used here\n (pattern synonyms cannot be promoted)\n\n\n\n {-# LANGUAGE DataKinds #-}\n {-# LANGUAGE TypeFamilies #-}\n {-# LANGUAGE PatternSynonyms #-}\n {-# LANGUAGE UndecidableInstances #-}\n\n data AB = Ab { a :: Nat, b :: Nat}\n pattern ZeroAB = Ab 0 0\n type family Tf ab where\n Tf ZeroAB = Ab 1 1\n Tf _ = Ab 0 0\n\n\nI haven’t found a corresponding issue on the GHC GitLab tracker, nor any discussion of this from the perspective of a potential language feature.\n\nI think it could be useful to have a GHC extension that allows this capability. The syntax of type families is fairly limited, and switching from an atomic type parameter to a record type parameter often introduces additional boilerplate. Being able to reuse pattern synonyms at the type level could help make type-family definitions more concise and maintainable.",
"title": "Pattern Synonyms and type families"
}