{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreigml55lwzdvmi2w67ywnmunb4ryejaffzncl5nhu4gdj7dw6y6prm",
    "uri": "at://did:plc:pi6woz4d47bkuws673w2il2r/app.bsky.feed.post/3mijm4yz6knu2"
  },
  "path": "/t/type-equality-in-gadt-typefamily-context/13876#post_1",
  "publishedAt": "2026-04-02T14:44:34.000Z",
  "site": "https://discourse.haskell.org",
  "textContent": "Hi,\n\nHow to make GHC to type-check the last branch of `pop` ?\nGHC understands that `x == c` in `Just Refl` case,\nbut it cannon unify default branch with last type family case.\n\n\n    {-# LANGUAGE GADTs #-}\n    {-# LANGUAGE RankNTypes #-}\n    {-# LANGUAGE DataKinds #-}\n    {-# LANGUAGE TypeFamilies #-}\n\n    import Prelude\n    import GHC.TypeLits\n    import Data.Proxy\n    import Data.Type.Equality\n\n    data N (l :: [Symbol]) where\n      NilN :: () -> N '[]\n      ConsN :: KnownSymbol x => Proxy x -> N l -> N (x : l)\n\n    type family Pop n c where\n      Pop '[]       _  = '[]\n      Pop (c ': n)  c  = n\n      Pop m         c  = m\n\n    pop :: forall c n. KnownSymbol c => N n -> Proxy c -> N (Pop n c)\n    pop (NilN ()) _  = NilN ()\n    pop l@(ConsN x n) c =\n     case sameSymbol x c of\n       Just Refl -> n\n       Nothing ->   l\n\n\n\n\n    Could not deduce ‘Pop (x : l) c ~ (x : l)’\n       from the context: (n ~ (x : l), KnownSymbol x)\n         bound by a pattern with constructor:\n                    ConsN :: forall (x :: Symbol) (l :: [Symbol]).\n                             KnownSymbol x =>\n                             Proxy x -> N l -> N (x : l),\n                  in an equation for ‘pop’\n\n\n(GHC 9.12.2)",
  "title": "Type equality in GADT/TypeFamily context"
}