A closed type family fixes every equation in its declaration. Its supported cases form a finite compile-time mapping, so extending it requires editing the family itself rather than adding an external instance. section 12.1.3
Selecting representation types
TypeSelector maps a domain marker and field marker to a concrete type: Domain' Int' becomes Int, SQLite' Int' becomes INTEGER, and Postgres' Int' becomes PgInt. The declaration lists all supported combinations, including identifiers, numeric values, and timestamps. section 12.1.3
Listing 12.2 Type family for picking types in compile time
type family TypeSelector typeSet t where TypeSelector Domain' Id' = Int TypeSelector Domain' Int' = Int TypeSelector Domain' Float' = Float TypeSelector Domain' Timestamp' = UTCTime TypeSelector SQLite' Id' = ID TypeSelector SQLite' Int' = INTEGER TypeSelector SQLite' Float' = FLOAT TypeSelector SQLite' Timestamp' = TIMESTAMP TypeSelector Postgres' Id' = PgPrimaryKey TypeSelector Postgres' Int' = PgInt TypeSelector Postgres' Float' = PgFloat TypeSelector Postgres' Timestamp' = PgTimestamp
Inspect the complete TypeSelector equation table and its explicitly bounded set of supported type combinations. section 12.1.3
