@@ -10,15 +10,55 @@
11[Stackage](https://www.stackage.org/package/squeal-postgresql)
11[Stackage](https://www.stackage.org/package/squeal-postgresql)
15+Squeal is a deep embedding of SQL into Haskell. By "deep embedding", I am abusing the
16+term somewhat. What I mean is that Squeal embeds both SQL terms and SQL types
17+into Haskell at the term and type levels respectively. This leads to a very high level
18+of type-safety in Squeal.
20+But Squeal embeds not just the structured query language of SQL but also the
21+data manipulation language and the data definition language; that's `SELECT`,
22+`INSERT`, `UPDATE`, `DELETE`, `WITH`, `CREATE`, `DROP`, and `ALTER` commands.
24+Squeal expressions closely match their corresponding SQL expressions so that
25+the SQL they actually generate is completely predictable. They are also highly
26+composable and cover a large portion of SQL.
30+* generic encoding of Haskell tuples and records into query parameters
31+ and generic decoding of query results into Haskell records
32+ using [`generics-sop`](https://hackage.haskell.org/package/generics-sop)
33+* access to SQL alias system using the `OverloadedLabels` extension
34+* type-safe `NULL` and `DEFAULT`
35+* type-safe SQL constraints `CHECK`, `UNIQUE`, `PRIMARY KEY` and `FOREIGN KEY`
36+* type-safe aggregation
37+* escape hatches for writing raw SQL
38+* [`mtl`](https://hackage.haskell.org/package/mtl) compatible monad transformer
39+ for executing as well as preparing queries and manipulations
40+ and [Atkey](https://bentnib.org/paramnotions-jfp.pdf) indexed monad transformer
41+ for executing definitions.
13## installation
46## installation
15`stack install squeal-postgresql`
48`stack install squeal-postgresql`
52+start postgres on localhost port `5432` and create a database named `exampledb`.
19Squeal is a deep embedding of PostgreSQL in Haskell. Let's see an example!
58Squeal is a deep embedding of PostgreSQL in Haskell. Let's see an example!
20First, we need some language extensions because Squeal uses modern GHC
59First, we need some language extensions because Squeal uses modern GHC
23>>> :set -XDataKinds -XDeriveGeneric -XOverloadedLabels
63>>> :set -XDataKinds -XDeriveGeneric -XOverloadedLabels
24>>> :set -XOverloadedStrings -XTypeApplications -XTypeOperators
64>>> :set -XOverloadedStrings -XTypeApplications -XTypeOperators