Description
-
It's redundant to check the kind of the type parameter starting in line 606. Type-inference for
List
already covers this.dhall-haskell/dhall/src/Dhall/TypeCheck.hs
Lines 597 to 613 in d6d3943
-
The subsequent check of the list elements is both wrong and apparently dead code, according to coverage reports. We're trying to compare the type of an element with the full
List X
annotation. If these were equivalent, the list would actually by ill-typed!
dhall-haskell/dhall/src/Dhall/TypeCheck.hs
Lines 615 to 624 in d6d3943
I think it would be best to completely get rid of the element processing here, but I'm not sure what would be the best way…
A) Pattern match for ListLit (Just _) []
and throw a BrokenInvariant
error.
B) Redefine the ListLit
constructor to contain a Either (Expr s a) (NonEmptySeq (Expr s a))
C) Make separate constructors for empty and non-empty lists.