Having to depend on field names for wiring components is tedious. If there aren't two different components of the same type in the environment, it's better to "autowire" them from the type information alone. We could dispense with field names altogeher!
So perhaps we could add a FirstFieldWithThatType helper (to be used with Generics and DerivingVia) that generated Has instances by searching matching types in the environment.
Instances would probably be hideously slow to compile for large environment records, but for smallish ones it could cut down the boilerplate.
Having to depend on field names for wiring components is tedious. If there aren't two different components of the same type in the environment, it's better to "autowire" them from the type information alone. We could dispense with field names altogeher!
So perhaps we could add a
FirstFieldWithThatType
helper (to be used with Generics and DerivingVia) that generatedHas
instances by searching matching types in the environment.Instances would probably be hideously slow to compile for large environment records, but for smallish ones it could cut down the boilerplate.