[Git][ghc/ghc][wip/T27627] Wibbles
Simon Peyton Jones pushed to branch wip/T27627 at Glasgow Haskell Compiler / GHC Commits: b15dcda8 by Simon Peyton Jones at 2026-08-14T16:13:07+01:00 Wibbles - - - - - 1 changed file: - compiler/GHC/Core.hs Changes: ===================================== compiler/GHC/Core.hs ===================================== @@ -647,7 +647,8 @@ Note [NON-BOTTOM-DICTS invariant] It is a global invariant (not checkable by Lint) that Every dictionary-typed expression is non-bottom - /except/: a unary class with a single method (see (NBD1)) + /except/: a unary class with a single field, either a single method, + or a single superclass: see (NBD1). These conditions are captured by GHC.Core.Type.isTerminatingType. @@ -692,8 +693,13 @@ Wrinkle (NBD1) A unary class has a single /superclass/ (rather than method) looks as if it will always terminate, because the superclass does: class C a => UC a where {} - But Note [Recursive superclasses] and Note [Solving superclass constraints] - are very subtle, so it seems safer to say that /all/ unary might diverge. + So we could try to be more clever, and say that a unary class constraint + always terminates if has a single superclass. + + But maybe that is too clever! Note [Recursive superclasses] and + Note [Solving superclass constraints] are very subtle, so it seems safer to + say that /all/ unary-class constraints might diverge. Remember, almost all + classes are non-unary, and thus definitely non-bottom. Note [Case expression invariants] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b15dcda84b0280c1474d998a1fe564b0... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b15dcda84b0280c1474d998a1fe564b0... You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
participants (1)
-
Simon Peyton Jones (@simonpj)