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": Next we define a simple relation (SELECT statement) in "src/examples.hs":
{% highlight haskell %} {% highlight haskell %}
account1 :: Relation () Account account_4_3_3a :: Relation () Account
account1 = relation $ do account_4_3_3a = relation $ do
a <- query account a <- query account
wheres $ a ! Account.productCd' `in'` values ["CHK", "SAV", "CD", "MM"] wheres $ #productCd a `in'` values ["CHK", "SAV", "CD", "MM"]
return a return a
{% endhighlight %} {% endhighlight %}
@ -134,13 +134,13 @@ account1 = relation $ do
Let's look at the signature of 'relation': Let's look at the signature of 'relation':
{% highlight haskell %} {% highlight haskell %}
relation :: QuerySimple (Projection Flat r) -> Relation () r relation :: QuerySimple (Record Flat r) -> Relation () r
{% endhighlight %} {% endhighlight %}
So, the type of the `do` should be `QuerySimple (Projection Flat r)`. `query` has the following type (note that this signature is simplified): 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 %} {% highlight haskell %}
query :: Relation () r -> QuerySimple (Projection Flat r) query :: Relation () r -> QuerySimple (Record Flat r)
{% endhighlight %} {% 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. `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.