gh-pages: update tutorial code to adjust to new HRR versions.

This commit is contained in:
Kei Hibino 2019-03-24 23:42:37 +09:00
parent b710a0a896
commit f11cbef77d

View File

@ -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
a <- query account
wheres $ a ! Account.productCd' `in'` values ["CHK", "SAV", "CD", "MM"]
account_4_3_3a :: Relation () Account
account_4_3_3a = relation $ do
a <- query account
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.