on dev help sign in
Update README.md
commit2af72cc70cdf3d62b8b49c746e20548bf3fc3487 authorEitan Chatav <eitan.chatav@gmail.com> dateMon 26 Mar 2018, 18:41 (9 years ago) parent435d329
1 file changed+40
README.md+40
README.md+40
@@ -10,15 +10,55 @@
1010
1111[Stackage](https://www.stackage.org/package/squeal-postgresql)
1212
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+
1346## installation
1447
1548`stack install squeal-postgresql`
1649
50+## testing
51+
52+start postgres on localhost port `5432` and create a database named `exampledb`.
53+
54+`stack test`
55+
1756## usage
1857
1958Squeal is a deep embedding of PostgreSQL in Haskell. Let's see an example!
2059First, we need some language extensions because Squeal uses modern GHC
2160features.
61+
2262```haskell
2363>>> :set -XDataKinds -XDeriveGeneric -XOverloadedLabels
2464>>> :set -XOverloadedStrings -XTypeApplications -XTypeOperators