M1
contains metadataThe M1
type attaches metadata to the type it wraps.
We see a lot of M1
s in Generics representations,
because every type, type constructor, and type parameter is wrapped in one.
The definition of M1
is:
newtype M1 kind meta f p = M1 (f p)
Depending on what is being wrapped we’ll encounter one of three pairs of kind
and meta
parameters.
wrapped type | kind |
meta |
---|---|---|
a type | D |
'MetaData typename module package isnewtype |
a constructor | C |
'MetaCons constructorname fixity isrecord |
a parameter | S |
'MetaSel fieldname unpacked strict strict2 |
As you can see there’s a lot of information attached here. To learn more about what it all means open the details pages for one of the metadata types.
Beware that M1
sometimes goes by the names D1
, C1
, and S1
.
These are type synonyms for M1
with the kind
parameter pre-applied:
type D1 = M1 D
type C1 = M1 C
type S1 = M1 S