
On Mon, Nov 01, 2021 at 04:07:02PM +0200, Markus Läll wrote:
Would it make sense to suppress the "fields of ... not initialized" when the type of the field is Void, or any other type with no data constructors? As the only way to construct void would be `undefined :: Void`, and the field already is undefined.
It makes the opposite of sense to me. The warning is there to tell you when you've failed to initialize a field. Whether you *can't* initialise a field because its type has no values makes no difference. You're still not initialising it! I sometimes use a polymorphic field to indicate whether a constructor can be present or not. For example data Expr a = Zero | One | Sum Expr Expr | Product a Expr Expr Now `type ProductExpr = Expr ()` is an `Expr` which might contain `Product`s. `type NoProductExpr = Expr Void` is an `Expr` which cannot because I "can't" write a `Product` constructor for it (at least not without getting a warning). I'm curious: how come you're in the situation where you need to fill in product types with `Void` entries? Tom