on dev help sign in
Update README.md
2af72ccEitan Chatav
README.md+40
@@ -10,15 +10,55 @@
10
10
11[Stackage](https://www.stackage.org/package/squeal-postgresql)
11[Stackage](https://www.stackage.org/package/squeal-postgresql)
12
12
13+## introduction
14+
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.
19+
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.
23+
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.
27+
28+## features
29+
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.
42+* migrations
43+* connection pools
44+* transactions
45+
13## installation
46## installation
14
47
15`stack install squeal-postgresql`
48`stack install squeal-postgresql`
16
49
50+## testing
51+
52+start postgres on localhost port `5432` and create a database named `exampledb`.
53+
54+`stack test`
55+
17## usage
56## usage
18
57
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
21features.
60features.
61+
22```haskell
62```haskell
23>>> :set -XDataKinds -XDeriveGeneric -XOverloadedLabels
63>>> :set -XDataKinds -XDeriveGeneric -XOverloadedLabels
24>>> :set -XOverloadedStrings -XTypeApplications -XTypeOperators
64>>> :set -XOverloadedStrings -XTypeApplications -XTypeOperators