@@ -129,8 +129,17 @@ CREATE statements
129129
130130>>> :set -XOverloadedLabels
131131>>> :{
132−printSQL $
133− createTable #tab ((int & nullable) `As` #a :* (real & nullable) `As` #b :* Nil) Nil
132+type Table = '[] :=>
133+ '[ "a" ::: 'NoDef :=> 'Null 'PGint4
134+ , "b" ::: 'NoDef :=> 'Null 'PGfloat4 ]
135+:}
136+
137+>>> :{
138+let
139+ setup :: Definition '[] '["tab" ::: 'Table Table]
140+ setup = createTable #tab
141+ (nullable int `as` #a :* nullable real `as` #b) Nil
142+in printSQL setup
134143:}
135144CREATE TABLE "tab" ("a" int NULL, "b" real NULL);
136145-}
@@ -155,12 +164,19 @@ Instead, the schema already has the table so if the table did not yet exist, the
155164the `Category` of `Definition`s.
156165
157166>>> :set -XOverloadedLabels -XTypeApplications
158−>>> type Table = '[] :=> '["a" ::: 'NoDef :=> 'Null 'PGint4, "b" ::: 'NoDef :=> 'Null 'PGfloat4]
167+>>> :{
168+type Table = '[] :=>
169+ '[ "a" ::: 'NoDef :=> 'Null 'PGint4
170+ , "b" ::: 'NoDef :=> 'Null 'PGfloat4 ]
171+:}
172+
159173>>> type Schema = '["tab" ::: 'Table Table]
174+
160175>>> :{
161176let
162177 setup :: Definition Schema Schema
163− setup = createTableIfNotExists #tab ((int & nullable) `As` #a :* (real & nullable) `As` #b :* Nil) Nil
178+ setup = createTableIfNotExists #tab
179+ (nullable int `as` #a :* nullable real `as` #b) Nil
164180in printSQL setup
165181:}
166182CREATE TABLE IF NOT EXISTS "tab" ("a" int NULL, "b" real NULL);
@@ -850,11 +866,20 @@ createTypeEnumFrom
850866createTypeEnumFrom enum = createTypeEnum enum
851867 (SOP.hpure label :: NP PGlabel (LabelsFrom hask))
852868
853−-- | `createTypeComposite` creates a composite type. The composite type is
854−-- specified by a list of attribute names and data types.
855−--
856−-- >>> printSQL $ createTypeComposite #complex (float8 `As` #real :* float8 `As` #imaginary :* Nil)
857−-- CREATE TYPE "complex" AS ("real" float8, "imaginary" float8);
869+{- | `createTypeComposite` creates a composite type. The composite type is
870+specified by a list of attribute names and data types.
871+
872+>>> type PGcomplex = 'PGcomposite '["real" ::: 'PGfloat8, "imaginary" ::: 'PGfloat8]
873+
874+>>> :{
875+let
876+ setup :: Definition '[] '["complex" ::: 'Typedef PGcomplex]
877+ setup = createTypeComposite #complex
878+ (float8 `as` #real :* float8 `as` #imaginary)
879+in printSQL setup
880+:}
881+CREATE TYPE "complex" AS ("real" float8, "imaginary" float8);
882+-}
858883createTypeComposite
859884 :: (KnownSymbol ty, SOP.SListI fields)
860885 => Alias ty