Skip to content

Allow unconstrained existential contexts in newtypes

Declarations like

newtype Bar = forall a. Bar (Foo a)

ought to be allowed so long as no typeclass constraints are added. Right now, this requires data rather than newtype.

The wiki page wiki:NewtypeOptimizationForGADTS summarises the proposal

Edited by Simon Peyton Jones
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information