on master help sign in
Merge branch 'master' of https://github.com/agentm/project-m36
commitefc8ec0cb5701049a9e41ea2334002f28b8b17a8 authorAgentM <agentm@themactionfaction.com> dateFri 16 Nov 2018, 10:00 (8 years ago) parent610dfe7d6c2585
4 files changed+21−33
docs/introduction_to_projectm36.markdown+1−1 docs/new_datatypes.markdown+1−1 docs/transaction_graph_operators.markdown+2−14 docs/tutd_tutorial.markdown+17−17
docs/introduction_to_projectm36.markdown+1−1
@@ -40,7 +40,7 @@ Compilation steps:
4040
4141* ```git clone https://github.com/agentm/project-m36```
4242* ```cd project-m36```
43−* ```stack --stack_yaml stack.ghc8.2.yaml build```
43+* ```stack --stack-yaml stack.ghc8.2.yaml build```
4444
4545At this point, the TutorialD interactive interpreter can be run using ```stack exec tutd```.
4646
docs/new_datatypes.markdown+1−1
@@ -106,6 +106,6 @@ The essential ```Atomable``` typeclass functions are:
106106| ```toAtomType :: Proxy a -> AtomType``` | generate a database AtomType for a Haskell datatype |
107107| ```toAddTypeExpr :: Proxy a -> DatabaseContextExpr``` | generate a ```DatabaseContextExpr``` which can be executed against a database context in order to add the new type |
108108
109−In addition, basic Haskell data types like ```Int```, ```Double```, ```Text```, ```Day```, ```Bool```, ```UTCTime```, and l```ByteString``` already have `Atomable` instances ready-to-go. In addition, an ```Atomable``` instance is available for lists: ```Atomable a => [a]```, though one should be very careful not to use this in a common anti-pattern. Typically, it makes more sense to store one-to-many relationships as discrete relation variables; when storing them as lists, one gives up the various query capabilities and optimizations of the relational algebra.
109+In addition, basic Haskell data types like ```Int```, ```Double```, ```Text```, ```Day```, ```Bool```, ```UTCTime```, and ```ByteString``` already have `Atomable` instances ready-to-go. In addition, an ```Atomable``` instance is available for lists: ```Atomable a => [a]```, though one should be very careful not to use this in a common anti-pattern. Typically, it makes more sense to store one-to-many relationships as discrete relation variables; when storing them as lists, one gives up the various query capabilities and optimizations of the relational algebra.
110110
111111To be clear, these data types are not black boxes once stored in the database. These new types can be scanned and manipulated by Haskell scripts which can be created at runtime. For more information, read about [```AtomFunction```s](/docs/atomfunctions.markdown).
docs/transaction_graph_operators.markdown+2−14
@@ -10,23 +10,11 @@ When a new database is created, a new transaction graph is created for it with o
1010
1111As the user interactively alters the database context such as by adding a new relation variable, the database context is no longer equal to that of the first transactions. This is called "database context divergence" because many of the same components exist in both the updated context and the context of the first transaction.
1212
13−![Initial database starting state](http://g.gravizo.com/g?
14−digraph G {
15− base[label="base transaction",shape=rectangle];
16− new[label="mutable database context"];
17− new -> base;
18−})
13+![Initial database starting state](http://g.gravizo.com/g?%20digraph%20G%20{%20base[label=%22base%20transaction%22,shape=rectangle];%20new[label=%22mutable%20database%20context%22];%20new%20-%3E%20base;%20})
1914
2015Once the user decides that the changes in the updated database context are worth adding to the transaction graph, the user issues a "commit" request. The commit operation converts the current database context into a new transaction which is then added to the graph with the parent transaction set to the same parent transaction as the database context. The user's mutable database context is shifted to be a copy of the context of the newly-committed transaction.
2116
22−![Freshly committed transaction](http://g.gravizo.com/g?
23−digraph G {
24− base[label="base transaction",shape=rectangle];
25− discon[label="mutable database context"];
26− fresh[label="newly committed transaction",shape=rectangle];
27− fresh -> base;
28− discon -> fresh;
29−})
17+![Freshly committed transaction](http://g.gravizo.com/g?%20digraph%20G%20{%20base[label=%22base%20transaction%22,shape=rectangle];%20discon[label=%22mutable%20database%20context%22];%20fresh[label=%22newly%20committed%20transaction%22,shape=rectangle];%20fresh%20-%3E%20base;%20discon%20-%3E%20fresh;%20})
3018
3119It can be handy to attempt to modify the database without altering the data that others may wish to continue to use and modify. If a set of transactions may diverge from another use-case for the data, the user may choose to "branch" the transaction graph. Branching allows the user to assign an arbitrary name to a series of transactions and then potentially merge the set of transactions back to the originating branch. Project:M36 creates a "master" branch when the transaction graph is first created.
3220
docs/tutd_tutorial.markdown+17−17
@@ -14,6 +14,22 @@ TutorialD (master/main):
1414
1515"master" refers to the name of the branch to which the current transaction will be potentially committing.
1616
17+### Date's Sample Relations
18+
19+The examples in this tutorial can be executed after loading Chris Date's sample relations using:
20+
21+```
22+:importexample date
23+```
24+
25+Each section assumes a fresh instance of the Date examples. The relation variables created in the script are:
26+
27+|Relation Variable Name|Description|
28+|----------------------|-----------|
29+|s|suppliers|
30+|p|parts|
31+|sp|contains mapping of which suppliers supply which parts|
32+
1733### Types
1834
1935TutorialD is strongly-typed. The basic built-in types are:
@@ -37,7 +53,7 @@ The ```interval``` function last two arguments are boolean values indicating whe
3753Project:M36 will complain loudly if the expected types do not match. Automatic type coercion does not exist.
3854
3955```
40−TutorialD (master/main): :showexpr S:{more:=add(10,@sname)}
56+TutorialD (master/main): :showexpr s:{more:=add(10,@sname)}
4157ERR: AtomFunctionTypeError "add" 2 IntAtomType StringAtomType
4258```
4359
@@ -68,22 +84,6 @@ Chris Date refers to these relations as "TABLE_DUM" and "TABLE_DEE" but such arb
6884products{}
6985```
7086
71−### Date's Sample Relations
72−
73−The examples in this tutorial can be executed after loading Chris Date's sample relations using:
74−
75−```
76−:importexample date
77−```
78−
79−Each section assumes a fresh instance of the Date examples. The relation variables created in the script are:
80−
81−|Relation Variable Name|Description|
82−|----------------------|-----------|
83−|s|suppliers|
84−|p|parts|
85−|sp|contains mapping of which suppliers supply which parts|
86−
8787### Relational Expressions
8888
8989A relational expression combines relational operators to create a new relation. ```tutd``` can display the result of executing a relational expression with ":showexpr".