---
synopsis: Remove `Distribution.Compat.Newtype`
packages: [Cabal-syntax]
prs: 12126
---

Remove `Distribution.Compat.Newtype` in favor of `class Coercible` from `base`.
The use cases of `class Newtype a b` were adjusted to require `Coercible a b` now,
which most notably affects `class FieldGrammar` and its instances.

The definitions of `instance Newtype a b` were replaced by exporting
newtype constructors (which is no worse for the purposes of incapsulation)
for `List`, `NonEmpty'`, `Flag'` and `NubList'`.

Whenever the old code required passing a "phantom" `a -> b` just for the sake of type inference,
the new code requires `proxy a b`, which is a more general type and does not make an impression
that the function will be actually called.
