@@ -63,16 +63,13 @@ type Schema = '[ "mp" ::: 'Table MemberOfParliament
63 , "groupp" ::: 'Table ParliamentGroup ]
63 , "groupp" ::: 'Table ParliamentGroup ]
69−We need the `DataKinds` extension to be able to express heterogenous lists containing
68+> _note_ We need the `DataKinds` extension to be able to express heterogenous lists containing
70−specific types like this one.
69+> specific types like this one.
73−You can perfectly call your table "group" and not "groupp" even though it is a
71+> You can perfectly call your table "group" and not "groupp" even though it is a
74−keyword in SQL - Squeal queries will be properly escaped.
72+> keyword in SQL - Squeal queries will be properly escaped.
@@ -95,11 +92,10 @@ type ParliamentaryGroup =
96- Let's split constraints and column to study the syntax a bit more.
93- Let's split constraints and column to study the syntax a bit more.
101−We are using `:::` and `:=>` to quickly express associations when writing
97+> _note_ We are using `:::` and `:=>` to quickly express associations when writing
102−our schema. We need the `TypeOperators` extension.]
98+> our schema. We need the `TypeOperators` extension.]
@@ -148,10 +144,10 @@ type MpCols =
149 * the type (obviously).
145 * the type (obviously).
153−.note[*
149+> _note_ GHC is already helping. If I named the "mp_id" column differently,
154−GHC is already helping. If I named the "mp_id" column differently, GHC would yell because I promised a primary key constraint on a column named `mp_id`, so there must be one.]
150+> GHC would yell because I promised a primary key constraint on a column named `mp_id`, so there must be one.]
@@ -161,7 +157,7 @@ GHC is already helping. If I named the "mp_id" column differently, GHC would yel
162- But before we play with this schema, we need to implement it.
158- But before we play with this schema, we need to implement it.
166```haskell
162```haskell
167setup :: Definition '[] Schema
163setup :: Definition '[] Schema
@@ -193,15 +189,14 @@ setup =
194- You use `>>>` to compose table creation.
190- You use `>>>` to compose table creation.
196−- Note that the compiler will catch any mistype between Schema and
192+> _note_ The compiler will catch any mistype between Schema and
197−definition; wrong nullability, wrong type, wrong name, etc.
193+> definition; wrong nullability, wrong type, wrong name, etc.
202−You'll also need `OverloadedLabels`, for naming stuff.
197+> _note_ You'll also need `OverloadedLabels`, for naming stuff.
203−This is mostly to avoid having to write manual proxies all
198+> This is mostly to avoid having to write manual proxies all
204−the time and for convenience.]
199+> the time and for convenience.
@@ -236,8 +231,8 @@ tearDown :: Definition Schema '[]
236tearDown = dropTable #mp >>> dropTable #groupp
231tearDown = dropTable #mp >>> dropTable #groupp
239−- Note that GHC will also detect the _proper_ order of what you typed in
234+> _note_ GHC will also detect the _proper_ order of what you typed in
240− downgrade and upgrade should there be any conflict (with foreign keys).
235+> downgrade and upgrade should there be any conflict (with foreign keys).
242```haskell
237```haskell
243initDB :: Migration IO '[] Schema
238initDB :: Migration IO '[] Schema
@@ -316,9 +311,8 @@ data MemberOfParliament =
316 , lastName :: Text }
311 , lastName :: Text }
319−- You'll note that we didn't use anything from Squeal.
314+> _note_ We didn't use anything from Squeal.
321−- The model can be entirely separated from the persistence layer.
315+> The model can be entirely separated from the persistence layer.
@@ -333,7 +327,7 @@ type GroupInsertionParams = '[ 'NotNull 'PGuuid
334- Params are not named, but they are indexed. You just need nullability and type.
328- Params are not named, but they are indexed. You just need nullability and type.
338```haskell
332```haskell
339groupInsertion :: Manipulation Schema GroupInsertionParams '[]
333groupInsertion :: Manipulation Schema GroupInsertionParams '[]
@@ -342,7 +336,7 @@ groupInsertion =
342 :* Set (param @2) `as` #name )
336 :* Set (param @2) `as` #name )
347- `TypeApplication` lets us use the index of parameters (counting from 1).
341- `TypeApplication` lets us use the index of parameters (counting from 1).
@@ -357,19 +351,19 @@ _Inserting a Member of Parliament_
358- We could create a naive query that takes MP uuid, first name, last name and group uuid...
352- We could create a naive query that takes MP uuid, first name, last name and group uuid...
362- But that's boring. So let's use the `INSERT INTO ... SELECT`.
356- But that's boring. So let's use the `INSERT INTO ... SELECT`.
366- We will build a query that will return as constants our MP's uuid, first name and last name...
360- We will build a query that will return as constants our MP's uuid, first name and last name...
370- ... and fetch the uuid of a group given the name of the group.
364- ... and fetch the uuid of a group given the name of the group.
374- There's a `insertQuery` utility function for that. All we have to do is write the `select` !
368- There's a `insertQuery` utility function for that. All we have to do is write the `select` !
@@ -595,7 +589,7 @@ type BaseParliamentSelection =
595 , "m" ::: TableToRow MpCols ]
589 , "m" ::: TableToRow MpCols ]
598−- Note that we've also put everything with table aliases: "g" and "m".
592+> _note_ We've also put everything with table aliases: "g" and "m".