data Expr = Var Int
|
newtype Expr = Var Int
|
General comment:
A newtype differs from a type synonym in that it creates a distinct type that must be explicitly coerced to or from the original type, this can improve the general efficiency of a large program with lot's of recursion over a particular simple data type.
Left to right comment:
A selected data type with a unary constructor is converted to a new type.
Right to left comment:
A selected newtype is converted to a data type with a unary constructor.
Left to right conditions:
The selected data type must have one unary constructor.
None.
Right to left conditions: