concept newtype in category haskell

This is an excerpt from Manning's book Haskell in Depth MEAP V12.
Remember that a
String
is a synonym for a list ofChar
, so the first two examples share an instance for lists (and this operation is just list concatenation). The third and fourth examples apply instances that represent addition and multiplication—two basic operations over numeric types. They featurenewtype
wrappersSum
andProduct
for any typea
with an instance ofNum a
.
Remember that we use the
deriving
clause ondata
(ornewtype
) declarations to ask a compiler to derive instances. We can also use standalone deriving via theStandaloneDeriving
GHC extension. The ideas we discuss below don’t depend on the actual way to run deriving algorithms. So I assume that we always use thederiving
clause.
Age {age = 33} "{\"age\":33}"