| ... |
... |
@@ -647,7 +647,8 @@ Note [NON-BOTTOM-DICTS invariant] |
|
647
|
647
|
It is a global invariant (not checkable by Lint) that
|
|
648
|
648
|
|
|
649
|
649
|
Every dictionary-typed expression is non-bottom
|
|
650
|
|
- /except/: a unary class with a single method (see (NBD1))
|
|
|
650
|
+ /except/: a unary class with a single field, either a single method,
|
|
|
651
|
+ or a single superclass: see (NBD1).
|
|
651
|
652
|
|
|
652
|
653
|
These conditions are captured by GHC.Core.Type.isTerminatingType.
|
|
653
|
654
|
|
| ... |
... |
@@ -692,8 +693,13 @@ Wrinkle (NBD1) |
|
692
|
693
|
A unary class has a single /superclass/ (rather than method) looks as if it
|
|
693
|
694
|
will always terminate, because the superclass does:
|
|
694
|
695
|
class C a => UC a where {}
|
|
695
|
|
- But Note [Recursive superclasses] and Note [Solving superclass constraints]
|
|
696
|
|
- are very subtle, so it seems safer to say that /all/ unary might diverge.
|
|
|
696
|
+ So we could try to be more clever, and say that a unary class constraint
|
|
|
697
|
+ always terminates if has a single superclass.
|
|
|
698
|
+
|
|
|
699
|
+ But maybe that is too clever! Note [Recursive superclasses] and
|
|
|
700
|
+ Note [Solving superclass constraints] are very subtle, so it seems safer to
|
|
|
701
|
+ say that /all/ unary-class constraints might diverge. Remember, almost all
|
|
|
702
|
+ classes are non-unary, and thus definitely non-bottom.
|
|
697
|
703
|
|
|
698
|
704
|
Note [Case expression invariants]
|
|
699
|
705
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|