mirror of
https://github.com/khibino/haskell-relational-record.git
synced 2024-11-28 22:24:49 +03:00
gh-pages: update tutorial code to adjust to new HRR versions.
This commit is contained in:
parent
b710a0a896
commit
f11cbef77d
10
tutorial.md
10
tutorial.md
@ -122,10 +122,10 @@ custId'
|
||||
Next we define a simple relation (SELECT statement) in "src/examples.hs":
|
||||
|
||||
{% highlight haskell %}
|
||||
account1 :: Relation () Account
|
||||
account1 = relation $ do
|
||||
account_4_3_3a :: Relation () Account
|
||||
account_4_3_3a = relation $ do
|
||||
a <- query account
|
||||
wheres $ a ! Account.productCd' `in'` values ["CHK", "SAV", "CD", "MM"]
|
||||
wheres $ #productCd a `in'` values ["CHK", "SAV", "CD", "MM"]
|
||||
return a
|
||||
{% endhighlight %}
|
||||
|
||||
@ -134,13 +134,13 @@ account1 = relation $ do
|
||||
Let's look at the signature of 'relation':
|
||||
|
||||
{% highlight haskell %}
|
||||
relation :: QuerySimple (Projection Flat r) -> Relation () r
|
||||
relation :: QuerySimple (Record Flat r) -> Relation () r
|
||||
{% endhighlight %}
|
||||
|
||||
So, the type of the `do` should be `QuerySimple (Projection Flat r)`. `query` has the following type (note that this signature is simplified):
|
||||
|
||||
{% highlight haskell %}
|
||||
query :: Relation () r -> QuerySimple (Projection Flat r)
|
||||
query :: Relation () r -> QuerySimple (Record Flat r)
|
||||
{% endhighlight %}
|
||||
|
||||
`account` is the variable which refers to the "Account" table. This is automatically generated by `defineTableFromDB` and its type is `Relation () r`. So `a <- query account` binds the variable `a` to each row of the "Account" table.
|
||||
|
Loading…
Reference in New Issue
Block a user