on master help sign in
Merge branch 'master' into YuMingLiao-feature/dataframe
d4d1df8AgentM
.appveyor.yml+4−1
@@ -16,6 +16,9 @@ clone_depth: 2
16environment:
16environment:
17 global:
17 global:
18 STACK_ROOT: "c:\\sr"
18 STACK_ROOT: "c:\\sr"
19+ matrix:
20+ - YAML: "stack.ghc8.2.yaml"
21+ - YAML: "stack.ghc8.4.yaml"
19
22
20platform:
23platform:
21 - x64
24 - x64
@@ -29,7 +32,7 @@ test_script:
29 - stack setup > nul
32 - stack setup > nul
30# The ugly echo "" hack is to avoid complaints about 0 being an invalid file
33# The ugly echo "" hack is to avoid complaints about 0 being an invalid file
31# descriptor
34# descriptor
32− - echo "" | stack --no-terminal test
35+ - echo "" | stack --stack-yaml %YAML% --no-terminal test
33# - 7z.exe a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on project-m36.7z .stack-work\install\*\bin\project-m36-server.exe .stack-work\install\*\bin\project-m36-websocket-server.exe .stack-work\install\*\bin\tutd.exe .stack-work\install\*\bin\project-m36-server.exe
36# - 7z.exe a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on project-m36.7z .stack-work\install\*\bin\project-m36-server.exe .stack-work\install\*\bin\project-m36-websocket-server.exe .stack-work\install\*\bin\tutd.exe .stack-work\install\*\bin\project-m36-server.exe
34
37
35#artifacts:
38#artifacts:
.travis.yml+7−7
@@ -16,16 +16,16 @@ cache:
16matrix:
16matrix:
17 fast_finish: true
17 fast_finish: true
18 include:
18 include:
19− - env: CACHE_NAME=7.10.3 STACK_YAML=stack.ghc7.10.yaml
19+ - env: CACHE_NAME=8.2.2 STACK_YAML=stack.ghc8.2.yaml
20− compiler: ": #stack 7.10.3"
20+ compiler: ": #stack 8.2.2"
21
21
22− - env: CACHE_NAME=8.0.2 STACK_YAML=stack.yaml
23− compiler: ": #stack 8.0.2"
24−
25− - env: CACHE_NAME=osx-8.0.2 STACK_YAML=stack.yaml
22+ - env: CACHE_NAME=osx-8.2.2 STACK_YAML=stack.ghc8.2.yaml
26 os: osx
23 os: osx
27 os_image: xcode7.3
24 os_image: xcode7.3
28− compiler: ": #stack 8.0.2"
25+ compiler: ": #stack 8.2.2"
26+
27+ - env: CACHE_NAME=8.4.3 STACK_YAML=stack.ghc8.4.yaml
28+ compiler: ": #stack 8.4.3"
29
29
30before_script:
30before_script:
31 - unset CC
31 - unset CC
.travis/install-dependencies.sh+1−1
@@ -4,7 +4,7 @@ if [[ "$(uname)" = "Darwin" ]]; then
4else
4else
5 timeout_cmd="timeout"
5 timeout_cmd="timeout"
6fi
6fi
7−$timeout_cmd 15m stack --no-terminal --jobs=2 --install-ghc --system-ghc build --only-dependencies --fast
7+$timeout_cmd 40m stack --no-terminal --jobs=2 --install-ghc --system-ghc build --only-dependencies --fast
8ret=$?
8ret=$?
9case "$ret" in
9case "$ret" in
10 0)
10 0)
Changelog.markdown+13
@@ -1,3 +1,16 @@
1+# 2018-10-03 (v0.5.1)
2+
3+* fix atom function type validation
4+* add support for GHC 8.4 (now we support GHC 8.0, 8.2, and 8.4)
5+
6+# 2018-08-10 (v0.5)
7+
8+* fix critical type bug which allowed unresolved types to be used
9+* add full support for GHC 8.2 with stack or cabal (delayed for a long time by dependency version boundaries)
10+* drop support for GHC 7.10
11+* add support for `with (relexpr as name,...)` syntax for use as tutd macros
12+* add `NonEmptyList` list data type
13+
1# 2018-06-04 (v0.4)
14# 2018-06-04 (v0.4)
2
15
3* add contributed feature to allow users to [create arbitrary relations](https://github.com/agentm/project-m36/blob/master/docs/tutd_tutorial.markdown#arbitrary-relation-variables)
16* add contributed feature to allow users to [create arbitrary relations](https://github.com/agentm/project-m36/blob/master/docs/tutd_tutorial.markdown#arbitrary-relation-variables)
README.markdown+1−1
@@ -86,7 +86,7 @@ Project:M36 supports multiple frontends which target different audiences.
86
86
87## Development
87## Development
88
88
89−Project:M36 is developed in Haskell and compiled with GHC 7.10 or GHC 8.0.2 or later.
89+Project:M36 is developed in Haskell and compiled with GHC 8.0.2 or later.
90
90
91## Related Projects
91## Related Projects
92
92
docs/atomfunctions.markdown+1−1
@@ -15,7 +15,7 @@ In this example, we install an atom function to convert between Fahrenheit and C
15We write the function giving it the name "celsiusToFahrenheit" with type ```Int -> Int``` which indicates to the compiler that the function take one ```Int``` argument value and returns one ```Int``` value. Finally, the body of the function is implemented in quotes or triple-quotes. Note that the function makes use of the "[ProjectM36.Base](/src/lib/ProjectM36/Base.hs)" module to handle the Atom type. The function must take a list of Atoms as arguments and return an Atom. The standard GHC Prelude is available in this AtomFunctionBody context.
15We write the function giving it the name "celsiusToFahrenheit" with type ```Int -> Int``` which indicates to the compiler that the function take one ```Int``` argument value and returns one ```Int``` value. Finally, the body of the function is implemented in quotes or triple-quotes. Note that the function makes use of the "[ProjectM36.Base](/src/lib/ProjectM36/Base.hs)" module to handle the Atom type. The function must take a list of Atoms as arguments and return an Atom. The standard GHC Prelude is available in this AtomFunctionBody context.
16
16
17```
17```
18−TutorialD (master/main): addatomfunction "celsiusToFahrenheit" Int -> Either AtomFunctionError Int """(\\((IntAtom c):_) -> pure $ IntAtom ( (c * 9 `div` 5) + 32)) :: [Atom] -> Either AtomFunctionError Atom"""
18+TutorialD (master/main): addatomfunction "celsiusToFahrenheit" Int -> Either AtomFunctionError Int """(\((IntAtom c):_) -> pure $ IntAtom ( (c * 9 `div` 5) + 32)) :: [Atom] -> Either AtomFunctionError Atom"""
19```
19```
20
20
21Using triple-quotes allows quotes to be used inside the string without backslash escaping, which can become tedious. The sum type using ```Either``` allows the function to return an error, if necessary.
21Using triple-quotes allows quotes to be used inside the string without backslash escaping, which can become tedious. The sum type using ```Either``` allows the function to return an error, if necessary.
docs/introduction_to_projectm36.markdown+7−5
@@ -30,23 +30,25 @@ The currently-preferred method of installation is from source. A future enhancem
30
30
31Requirements:
31Requirements:
32
32
33+To build with stack:
34+
33−* [GHC 7.10 or greater](https://www.haskell.org/downloads)
35+* [GHC 8.2.2 or greater](https://www.haskell.org/downloads)
34* [Haskell stack](https://docs.haskellstack.org/en/stable/README/)
36* [Haskell stack](https://docs.haskellstack.org/en/stable/README/)
35−* Linux, MacOS X, or Windows OS
37+* Linux, macOS, or Microsoft Windows
36
38
37Compilation steps:
39Compilation steps:
38
40
39* ```git clone https://github.com/agentm/project-m36```
41* ```git clone https://github.com/agentm/project-m36```
40* ```cd project-m36```
42* ```cd project-m36```
41−* ```stack build```
43+* ```stack --stack-yaml stack.ghc8.2.yaml build```
42
44
43At this point, the TutorialD interactive interpreter can be run using ```stack exec tutd```.
45At this point, the TutorialD interactive interpreter can be run using ```stack exec tutd```.
44
46
45−Alternative building with GHC 8.0.x:
47+Alternative building with GHC 8.0.2 or greater:
46
48
47* ```cabal new-build```
49* ```cabal new-build```
48
50
49−The resultant binaries can be found in ```./dist-newstyle/build/project-m36-0.1/build```.
51+The resultant binaries can be found in ```./dist-newstyle/build/project-m36-<version>/build```.
50
52
51## Accessing Project:M36 Databases
53## Accessing Project:M36 Databases
52
54
docs/new_datatypes.markdown+1−1
@@ -106,6 +106,6 @@ The essential ```Atomable``` typeclass functions are:
106| ```toAtomType :: Proxy a -> AtomType``` | generate a database AtomType for a Haskell datatype |
106| ```toAtomType :: Proxy a -> AtomType``` | generate a database AtomType for a Haskell datatype |
107| ```toAddTypeExpr :: Proxy a -> DatabaseContextExpr``` | generate a ```DatabaseContextExpr``` which can be executed against a database context in order to add the new type |
107| ```toAddTypeExpr :: Proxy a -> DatabaseContextExpr``` | generate a ```DatabaseContextExpr``` which can be executed against a database context in order to add the new type |
108
108
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.
110
110
111To 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).
111To 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
10
10
11As 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.
11As 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.
12
12
13−![Initial database starting state](http://g.gravizo.com/g?
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})
14−digraph G {
15− base[label="base transaction",shape=rectangle];
16− new[label="mutable database context"];
17− new -> base;
18−})
19
14
20Once 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.
15Once 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.
21
16
22−![Freshly committed transaction](http://g.gravizo.com/g?
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})
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−})
30
18
31It 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.
19It 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.
32
20
docs/tutd_tutorial.markdown+17−17
@@ -14,6 +14,22 @@ TutorialD (master/main):
14
14
15"master" refers to the name of the branch to which the current transaction will be potentially committing.
15"master" refers to the name of the branch to which the current transaction will be potentially committing.
16
16
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+
17### Types
33### Types
18
34
19TutorialD is strongly-typed. The basic built-in types are:
35TutorialD is strongly-typed. The basic built-in types are:
@@ -37,7 +53,7 @@ The ```interval``` function last two arguments are boolean values indicating whe
37Project:M36 will complain loudly if the expected types do not match. Automatic type coercion does not exist.
53Project:M36 will complain loudly if the expected types do not match. Automatic type coercion does not exist.
38
54
39```
55```
40−TutorialD (master/main): :showexpr S:{more:=add(10,@sname)}
56+TutorialD (master/main): :showexpr s:{more:=add(10,@sname)}
41ERR: AtomFunctionTypeError "add" 2 IntAtomType StringAtomType
57ERR: AtomFunctionTypeError "add" 2 IntAtomType StringAtomType
42```
58```
43
59
@@ -68,22 +84,6 @@ Chris Date refers to these relations as "TABLE_DUM" and "TABLE_DEE" but such arb
68products{}
84products{}
69```
85```
70
86
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−
87### Relational Expressions
87### Relational Expressions
88
88
89A relational expression combines relational operators to create a new relation. ```tutd``` can display the result of executing a relational expression with ":showexpr".
89A relational expression combines relational operators to create a new relation. ```tutd``` can display the result of executing a relational expression with ":showexpr".
project-m36.cabal+45−98
@@ -1,5 +1,5 @@
1Name: project-m36
1Name: project-m36
2−Version: 0.4
2+Version: 0.5.1
3License: PublicDomain
3License: PublicDomain
4Build-Type: Simple
4Build-Type: Simple
5Homepage: https://github.com/agentm/project-m36
5Homepage: https://github.com/agentm/project-m36
@@ -22,71 +22,14 @@ Flag profiler
22 Default: False
22 Default: False
23 Manual: True
23 Manual: True
24
24
25+--flag to allow stack to use its older, pinned packages
26+Flag stack
27+ Description: build with stack and stackage
28+ Manual: True
29+ Default: False
30+
25Library
31Library
26− Build-Depends: base>=4.8 && < 6.0
32+ Build-Depends: base>=4.8 && < 4.12, ghc >= 7.8 && < 8.5, ghc-paths, mtl, containers, unordered-containers, hashable, haskeline, directory, MonadRandom, random-shuffle, uuid >= 1.3.12, cassava >= 0.4.5.1 && < 0.6, text, bytestring, deepseq, deepseq-generics, vector, parallel, monad-parallel, exceptions, transformers, gnuplot, binary, filepath, zlib, directory, vector-binary-instances, temporary, stm, time, hashable-time, old-locale, rset, attoparsec, either, base64-bytestring, data-interval, extended-reals, network-transport, aeson >= 1.1, path-pieces, conduit, resourcet, http-api-data, semigroups, QuickCheck, quickcheck-instances, distributed-process-client-server >= 0.2.3, distributed-process >= 0.7.4, distributed-process-extras >= 0.3.2, distributed-process-async >= 0.2.4.1, network-transport-tcp >= 0.6.0, network-transport, list-t, stm-containers >= 0.2.15, foldl, optparse-applicative, Glob, cryptohash-sha256
27− ,ghc >= 7.8 && < 8.3
28− ,ghc-paths
29− ,mtl
30− ,containers
31− ,unordered-containers
32− ,hashable
33− ,haskeline
34− ,directory
35− ,MonadRandom
36− ,random-shuffle
37− --critical uuid bug in lesser versions https://www.reddit.com/r/haskell/comments/4myot5/psa_make_sure_to_use_uuid_1312/
38− ,uuid >= 1.3.12
39− ,cassava >= 0.4.5.1 && < 0.6
40− ,text
41− ,bytestring
42− ,deepseq
43− ,deepseq-generics
44− ,vector
45− ,parallel
46− ,monad-parallel
47− ,exceptions
48− ,transformers
49− ,gnuplot
50− ,binary
51− ,filepath
52− ,zlib
53− ,directory
54− ,vector-binary-instances
55− ,temporary
56− ,stm
57− ,time
58− ,hashable-time
59− ,old-locale
60− ,rset
61− --used for CSV parsing
62− ,attoparsec
63− ,either
64− ,base64-bytestring
65− ,data-interval
66− ,extended-reals
67− ,network-transport
68− -- aeson 1.1 and above includes instances for UUID types
69− ,aeson >= 1.1
70− ,path-pieces
71− ,conduit
72− ,resourcet
73− ,http-api-data
74− ,semigroups
75− -- used for arbitrary tuples
76− ,QuickCheck
77−--needed for remote access
78− ,distributed-process-client-server >= 0.2.3
79− ,distributed-process >= 0.6.6
80− ,distributed-process-extras >= 0.3.2
81− ,distributed-process-async >= 0.2.4
82− ,network-transport-tcp >= 0.6.0
83− ,network
84− ,list-t
85− ,stm-containers >= 0.2.15
86− ,optparse-applicative
87− ,Glob
88−--used for hashing the transaction graph file to check for differences
89− ,cryptohash-sha256
90 Exposed-Modules: ProjectM36.Error,
33 Exposed-Modules: ProjectM36.Error,
91 ProjectM36.Transaction,
34 ProjectM36.Transaction,
92 ProjectM36.TransactionGraph,
35 ProjectM36.TransactionGraph,
@@ -161,9 +104,11 @@ Library
161 ProjectM36.Arbitrary
104 ProjectM36.Arbitrary
162 GHC-Options: -Wall -rdynamic
105 GHC-Options: -Wall -rdynamic
163 if os(windows)
106 if os(windows)
164− Build-Depends: Win32 >= 2.3
107+ Build-Depends: Win32 >= 2.5.4.1
165 Other-Modules: ProjectM36.Win32Handle
108 Other-Modules: ProjectM36.Win32Handle
166 else
109 else
110+ --219- too many exported symbols under Windows and GHC 8.4
111+ GHC-Options: -rdynamic
167 C-sources: cbits/DirectoryFsync.c, cbits/darwin_statfs.c
112 C-sources: cbits/DirectoryFsync.c, cbits/darwin_statfs.c
168 Build-Depends: unix
113 Build-Depends: unix
169 CC-Options: -fPIC
114 CC-Options: -fPIC
@@ -173,10 +118,12 @@ Library
173 if impl(ghc>= 8)
118 if impl(ghc>= 8)
174 build-depends:
119 build-depends:
175 ghc-boot, ghci
120 ghc-boot, ghci
121+ if !flag(stack)
122+ Build-Depends: deferred-folds
176
123
177Executable tutd
124Executable tutd
178 Build-Depends: base >=4.8 && <5.0,
125 Build-Depends: base >=4.8 && <5.0,
179− ghc >= 7.8 && < 8.3,
126+ ghc >= 7.8 && < 8.5,
180 ghc-paths,
127 ghc-paths,
181 project-m36,
128 project-m36,
182 containers,
129 containers,
@@ -204,13 +151,13 @@ Executable tutd
204 directory,
151 directory,
205 filepath,
152 filepath,
206 temporary,
153 temporary,
207− megaparsec >= 5.2.0 && < 5.4,
154+ megaparsec >= 5.2.0 && < 7,
208 haskeline,
155 haskeline,
209 random, MonadRandom,
156 random, MonadRandom,
210 base64-bytestring,
157 base64-bytestring,
211 optparse-applicative,
158 optparse-applicative,
212 attoparsec,
159 attoparsec,
213− stm-containers,
160+ stm-containers >= 1.0.0,
214 list-t
161 list-t
215 Other-Modules: TutorialD.Interpreter,
162 Other-Modules: TutorialD.Interpreter,
216 TutorialD.Interpreter.Base,
163 TutorialD.Interpreter.Base,
@@ -232,14 +179,14 @@ Executable tutd
232 TutorialD.Interpreter.SchemaOperator
179 TutorialD.Interpreter.SchemaOperator
233 main-is: TutorialD/tutd.hs
180 main-is: TutorialD/tutd.hs
234 CC-Options: -fPIC
181 CC-Options: -fPIC
235− GHC-Options: -Wall -rdynamic
182+ GHC-Options: -Wall -threaded
236 Hs-Source-Dirs: ./src/bin
183 Hs-Source-Dirs: ./src/bin
237 Default-Language: Haskell2010
184 Default-Language: Haskell2010
238 Default-Extensions: OverloadedStrings
185 Default-Extensions: OverloadedStrings
239
186
240Executable project-m36-server
187Executable project-m36-server
241 Build-Depends: base,
188 Build-Depends: base,
242− ghc >= 7.8 && < 8.3,
189+ ghc >= 7.8 && < 8.5,
243 ghc-paths,
190 ghc-paths,
244 project-m36,
191 project-m36,
245 binary,
192 binary,
@@ -269,7 +216,7 @@ Executable project-m36-server
269 list-t,
216 list-t,
270 base64-bytestring
217 base64-bytestring
271 Main-Is: ./src/bin/ProjectM36/Server/project-m36-server.hs
218 Main-Is: ./src/bin/ProjectM36/Server/project-m36-server.hs
272− GHC-Options: -Wall -threaded -rtsopts
219+ GHC-Options: -Wall -threaded -rtsopts
273 if flag(profiler)
220 if flag(profiler)
274 GHC-Prof-Options: -fprof-auto -rtsopts -threaded -Wall
221 GHC-Prof-Options: -fprof-auto -rtsopts -threaded -Wall
275 Default-Language: Haskell2010
222 Default-Language: Haskell2010
@@ -307,7 +254,7 @@ Test-Suite test-tutoriald
307 main-is: test/TutorialD/Interpreter.hs
254 main-is: test/TutorialD/Interpreter.hs
308 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, stm-containers, list-t, project-m36, random, MonadRandom, semigroups
255 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, stm-containers, list-t, project-m36, random, MonadRandom, semigroups
309 Other-Modules: TutorialD.Interpreter, TutorialD.Interpreter.Base, TutorialD.Interpreter.Export.Base, TutorialD.Interpreter.Export.CSV, TutorialD.Interpreter.Import.Base, TutorialD.Interpreter.Import.CSV, TutorialD.Interpreter.Import.TutorialD, TutorialD.Interpreter.RODatabaseContextOperator, TutorialD.Interpreter.RelationalExpr, TutorialD.Interpreter.TransactionGraphOperator, TutorialD.Interpreter.Types, TutorialD.Interpreter.DatabaseContextExpr, TutorialD.Interpreter.InformationOperator, TutorialD.Interpreter.Import.BasicExamples, TutorialD.Interpreter.DatabaseContextIOOperator, TutorialD.Interpreter.TestBase, TutorialD.Interpreter.TransGraphRelationalOperator, TutorialD.Interpreter.SchemaOperator
256 Other-Modules: TutorialD.Interpreter, TutorialD.Interpreter.Base, TutorialD.Interpreter.Export.Base, TutorialD.Interpreter.Export.CSV, TutorialD.Interpreter.Import.Base, TutorialD.Interpreter.Import.CSV, TutorialD.Interpreter.Import.TutorialD, TutorialD.Interpreter.RODatabaseContextOperator, TutorialD.Interpreter.RelationalExpr, TutorialD.Interpreter.TransactionGraphOperator, TutorialD.Interpreter.Types, TutorialD.Interpreter.DatabaseContextExpr, TutorialD.Interpreter.InformationOperator, TutorialD.Interpreter.Import.BasicExamples, TutorialD.Interpreter.DatabaseContextIOOperator, TutorialD.Interpreter.TestBase, TutorialD.Interpreter.TransGraphRelationalOperator, TutorialD.Interpreter.SchemaOperator
310− GHC-Options: -Wall
257+ GHC-Options: -Wall -threaded
311 Hs-Source-Dirs: ./src/bin, ., test
258 Hs-Source-Dirs: ./src/bin, ., test
312
259
313Test-Suite test-tutoriald-atomfunctionscript
260Test-Suite test-tutoriald-atomfunctionscript
@@ -317,7 +264,7 @@ Test-Suite test-tutoriald-atomfunctionscript
317 Other-Modules: TutorialD.Interpreter, TutorialD.Interpreter.Base, TutorialD.Interpreter.DatabaseContextExpr, TutorialD.Interpreter.DatabaseContextIOOperator, TutorialD.Interpreter.Export.Base, TutorialD.Interpreter.Export.CSV, TutorialD.Interpreter.Import.Base, TutorialD.Interpreter.Import.BasicExamples, TutorialD.Interpreter.Import.CSV, TutorialD.Interpreter.Import.TutorialD, TutorialD.Interpreter.InformationOperator, TutorialD.Interpreter.RODatabaseContextOperator, TutorialD.Interpreter.RelationalExpr, TutorialD.Interpreter.TestBase, TutorialD.Interpreter.TransGraphRelationalOperator, TutorialD.Interpreter.TransactionGraphOperator, TutorialD.Interpreter.Types, TutorialD.Interpreter.SchemaOperator
264 Other-Modules: TutorialD.Interpreter, TutorialD.Interpreter.Base, TutorialD.Interpreter.DatabaseContextExpr, TutorialD.Interpreter.DatabaseContextIOOperator, TutorialD.Interpreter.Export.Base, TutorialD.Interpreter.Export.CSV, TutorialD.Interpreter.Import.Base, TutorialD.Interpreter.Import.BasicExamples, TutorialD.Interpreter.Import.CSV, TutorialD.Interpreter.Import.TutorialD, TutorialD.Interpreter.InformationOperator, TutorialD.Interpreter.RODatabaseContextOperator, TutorialD.Interpreter.RelationalExpr, TutorialD.Interpreter.TestBase, TutorialD.Interpreter.TransGraphRelationalOperator, TutorialD.Interpreter.TransactionGraphOperator, TutorialD.Interpreter.Types, TutorialD.Interpreter.SchemaOperator
318 main-is: test/TutorialD/Interpreter/AtomFunctionScript.hs
265 main-is: test/TutorialD/Interpreter/AtomFunctionScript.hs
319 Build-Depends: base, HUnit, project-m36, uuid, containers, megaparsec, text, vector, directory, bytestring, mtl, haskeline, random, MonadRandom, semigroups, time
266 Build-Depends: base, HUnit, project-m36, uuid, containers, megaparsec, text, vector, directory, bytestring, mtl, haskeline, random, MonadRandom, semigroups, time
320− GHC-Options: -Wall
267+ GHC-Options: -Wall -threaded
321 Hs-Source-Dirs: ./src/bin, ./test, .
268 Hs-Source-Dirs: ./src/bin, ./test, .
322
269
323Test-Suite test-tutoriald-databasecontextfunctionscript
270Test-Suite test-tutoriald-databasecontextfunctionscript
@@ -327,7 +274,7 @@ Test-Suite test-tutoriald-databasecontextfunctionscript
327 Other-Modules: TutorialD.Interpreter, TutorialD.Interpreter.Base, TutorialD.Interpreter.DatabaseContextExpr, TutorialD.Interpreter.DatabaseContextIOOperator, TutorialD.Interpreter.Export.Base, TutorialD.Interpreter.Export.CSV, TutorialD.Interpreter.Import.Base, TutorialD.Interpreter.Import.BasicExamples, TutorialD.Interpreter.Import.CSV, TutorialD.Interpreter.Import.TutorialD, TutorialD.Interpreter.InformationOperator, TutorialD.Interpreter.RODatabaseContextOperator, TutorialD.Interpreter.RelationalExpr, TutorialD.Interpreter.TestBase, TutorialD.Interpreter.TransGraphRelationalOperator, TutorialD.Interpreter.TransactionGraphOperator, TutorialD.Interpreter.Types, TutorialD.Interpreter.SchemaOperator
274 Other-Modules: TutorialD.Interpreter, TutorialD.Interpreter.Base, TutorialD.Interpreter.DatabaseContextExpr, TutorialD.Interpreter.DatabaseContextIOOperator, TutorialD.Interpreter.Export.Base, TutorialD.Interpreter.Export.CSV, TutorialD.Interpreter.Import.Base, TutorialD.Interpreter.Import.BasicExamples, TutorialD.Interpreter.Import.CSV, TutorialD.Interpreter.Import.TutorialD, TutorialD.Interpreter.InformationOperator, TutorialD.Interpreter.RODatabaseContextOperator, TutorialD.Interpreter.RelationalExpr, TutorialD.Interpreter.TestBase, TutorialD.Interpreter.TransGraphRelationalOperator, TutorialD.Interpreter.TransactionGraphOperator, TutorialD.Interpreter.Types, TutorialD.Interpreter.SchemaOperator
328 main-is: test/TutorialD/Interpreter/DatabaseContextFunctionScript.hs
275 main-is: test/TutorialD/Interpreter/DatabaseContextFunctionScript.hs
329 Build-Depends: base, HUnit, project-m36, uuid, containers, megaparsec, text, vector, directory, bytestring, mtl, haskeline, random, MonadRandom, semigroups, time
276 Build-Depends: base, HUnit, project-m36, uuid, containers, megaparsec, text, vector, directory, bytestring, mtl, haskeline, random, MonadRandom, semigroups, time
330− GHC-Options: -Wall
277+ GHC-Options: -Wall -threaded
331 Hs-Source-Dirs: ./src/bin, ./test, .
278 Hs-Source-Dirs: ./src/bin, ./test, .
332
279
333Test-Suite test-relation
280Test-Suite test-relation
@@ -336,7 +283,7 @@ Test-Suite test-relation
336 type: exitcode-stdio-1.0
283 type: exitcode-stdio-1.0
337 main-is: test/Relation/Basic.hs
284 main-is: test/Relation/Basic.hs
338 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, stm-containers, project-m36, transformers
285 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, stm-containers, project-m36, transformers
339− GHC-Options: -Wall
286+ GHC-Options: -Wall -threaded
340
287
341Test-Suite test-static-optimizer
288Test-Suite test-static-optimizer
342 Default-Language: Haskell2010
289 Default-Language: Haskell2010
@@ -344,7 +291,7 @@ Test-Suite test-static-optimizer
344 type: exitcode-stdio-1.0
291 type: exitcode-stdio-1.0
345 main-is: test/Relation/StaticOptimizer.hs
292 main-is: test/Relation/StaticOptimizer.hs
346 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, stm-containers, project-m36, transformers
293 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, stm-containers, project-m36, transformers
347− GHC-Options: -Wall
294+ GHC-Options: -Wall -threaded
348
295
349Test-Suite test-transactiongraph-persist
296Test-Suite test-transactiongraph-persist
350 Default-Language: Haskell2010
297 Default-Language: Haskell2010
@@ -354,7 +301,7 @@ Test-Suite test-transactiongraph-persist
354 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, stm-containers, project-m36, random, MonadRandom, semigroups
301 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, stm-containers, project-m36, random, MonadRandom, semigroups
355 Other-Modules: TutorialD.Interpreter.Base, TutorialD.Interpreter.RelationalExpr, TutorialD.Interpreter.Types, TutorialD.Interpreter.DatabaseContextExpr, TutorialD.Interpreter.Import.BasicExamples
302 Other-Modules: TutorialD.Interpreter.Base, TutorialD.Interpreter.RelationalExpr, TutorialD.Interpreter.Types, TutorialD.Interpreter.DatabaseContextExpr, TutorialD.Interpreter.Import.BasicExamples
356 Hs-Source-Dirs: ., ./src/bin
303 Hs-Source-Dirs: ., ./src/bin
357− GHC-Options: -Wall
304+ GHC-Options: -Wall -threaded
358
305
359Test-Suite test-relation-import-csv
306Test-Suite test-relation-import-csv
360 Default-Language: Haskell2010
307 Default-Language: Haskell2010
@@ -362,7 +309,7 @@ Test-Suite test-relation-import-csv
362 type: exitcode-stdio-1.0
309 type: exitcode-stdio-1.0
363 main-is: test/Relation/Import/CSV.hs
310 main-is: test/Relation/Import/CSV.hs
364 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, stm-containers, project-m36
311 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, stm-containers, project-m36
365− GHC-Options: -Wall
312+ GHC-Options: -Wall -threaded
366
313
367Test-Suite test-tutoriald-import-tutoriald
314Test-Suite test-tutoriald-import-tutoriald
368 Default-Language: Haskell2010
315 Default-Language: Haskell2010
@@ -371,7 +318,7 @@ Test-Suite test-tutoriald-import-tutoriald
371 main-is: test/TutorialD/Interpreter/Import/TutorialD.hs
318 main-is: test/TutorialD/Interpreter/Import/TutorialD.hs
372 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, stm-containers, project-m36, random, MonadRandom, semigroups
319 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, stm-containers, project-m36, random, MonadRandom, semigroups
373 Other-Modules: TutorialD.Interpreter.Base, TutorialD.Interpreter.Import.Base, TutorialD.Interpreter.Import.TutorialD, TutorialD.Interpreter.RelationalExpr, TutorialD.Interpreter.Types, TutorialD.Interpreter.DatabaseContextExpr, TutorialD.Interpreter.Import.BasicExamples
320 Other-Modules: TutorialD.Interpreter.Base, TutorialD.Interpreter.Import.Base, TutorialD.Interpreter.Import.TutorialD, TutorialD.Interpreter.RelationalExpr, TutorialD.Interpreter.Types, TutorialD.Interpreter.DatabaseContextExpr, TutorialD.Interpreter.Import.BasicExamples
374− GHC-Options: -Wall
321+ GHC-Options: -Wall -threaded
375 Hs-Source-Dirs: ., ./src/bin
322 Hs-Source-Dirs: ., ./src/bin
376
323
377Test-Suite test-relation-export-csv
324Test-Suite test-relation-export-csv
@@ -380,7 +327,7 @@ Test-Suite test-relation-export-csv
380 type: exitcode-stdio-1.0
327 type: exitcode-stdio-1.0
381 main-is: test/Relation/Export/CSV.hs
328 main-is: test/Relation/Export/CSV.hs
382 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, stm-containers, project-m36
329 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, stm-containers, project-m36
383− GHC-Options: -Wall
330+ GHC-Options: -Wall -threaded
384
331
385Test-Suite test-transactiongraph-merge
332Test-Suite test-transactiongraph-merge
386 Default-Language: Haskell2010
333 Default-Language: Haskell2010
@@ -388,7 +335,7 @@ Test-Suite test-transactiongraph-merge
388 type: exitcode-stdio-1.0
335 type: exitcode-stdio-1.0
389 main-is: test/TransactionGraph/Merge.hs
336 main-is: test/TransactionGraph/Merge.hs
390 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, template-haskell, transformers, aeson, conduit, either, path-pieces, http-api-data, stm-containers, list-t, project-m36
337 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, template-haskell, transformers, aeson, conduit, either, path-pieces, http-api-data, stm-containers, list-t, project-m36
391− GHC-Options: -Wall
338+ GHC-Options: -Wall -threaded
392
339
393benchmark bench
340benchmark bench
394 Default-Language: Haskell2010
341 Default-Language: Haskell2010
@@ -396,7 +343,7 @@ benchmark bench
396 type: exitcode-stdio-1.0
343 type: exitcode-stdio-1.0
397 main-is: benchmark/Relation.hs
344 main-is: benchmark/Relation.hs
398 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, criterion, stm-containers, project-m36
345 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, criterion, stm-containers, project-m36
399− GHC-Options: -Wall -rtsopts
346+ GHC-Options: -Wall -rtsopts -threaded
400 Hs-Source-Dirs: ./src/bin
347 Hs-Source-Dirs: ./src/bin
401
348
402Test-Suite test-server
349Test-Suite test-server
@@ -406,28 +353,28 @@ Test-Suite test-server
406 main-is: test/Server/Main.hs
353 main-is: test/Server/Main.hs
407 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, network-transport-tcp, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, transformers, stm-containers, list-t, project-m36, network-transport, semigroups
354 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, network-transport-tcp, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, transformers, stm-containers, list-t, project-m36, network-transport, semigroups
408 HS-Source-Dirs: ., ./src/bin
355 HS-Source-Dirs: ., ./src/bin
409− GHC-Options: -Wall
356+ GHC-Options: -Wall -threaded
410
357
411Executable Example-SimpleClient
358Executable Example-SimpleClient
412 Default-Language: Haskell2010
359 Default-Language: Haskell2010
413 Default-Extensions: OverloadedStrings
360 Default-Extensions: OverloadedStrings
414 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, transformers, stm-containers, list-t, ghc, ghc-paths, project-m36, random, MonadRandom
361 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, transformers, stm-containers, list-t, ghc, ghc-paths, project-m36, random, MonadRandom
415 Main-Is: examples/SimpleClient.hs
362 Main-Is: examples/SimpleClient.hs
416− GHC-Options: -Wall
363+ GHC-Options: -Wall -threaded
417
364
418Executable Example-OutOfTheTarpit
365Executable Example-OutOfTheTarpit
419 Default-Language: Haskell2010
366 Default-Language: Haskell2010
420 Default-Extensions: OverloadedStrings
367 Default-Extensions: OverloadedStrings
421 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, transformers, stm-containers, list-t, aeson, path-pieces, either, conduit, http-api-data, template-haskell, ghc, ghc-paths, project-m36
368 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, transformers, stm-containers, list-t, aeson, path-pieces, either, conduit, http-api-data, template-haskell, ghc, ghc-paths, project-m36
422 Main-Is: examples/out_of_the_tarpit.hs
369 Main-Is: examples/out_of_the_tarpit.hs
423− GHC-Options: -Wall
370+ GHC-Options: -Wall -threaded
424
371
425Executable Example-Blog
372Executable Example-Blog
426 Default-Language: Haskell2010
373 Default-Language: Haskell2010
427 Default-Extensions: OverloadedStrings
374 Default-Extensions: OverloadedStrings
428 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, transformers, stm-containers, list-t, aeson, path-pieces, either, conduit, http-api-data, template-haskell, ghc, ghc-paths, project-m36, scotty, blaze-html, http-types
375 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, transformers, stm-containers, list-t, aeson, path-pieces, either, conduit, http-api-data, template-haskell, ghc, ghc-paths, project-m36, scotty, blaze-html, http-types
429 Main-Is: examples/blog.hs
376 Main-Is: examples/blog.hs
430− GHC-Options: -Wall
377+ GHC-Options: -Wall -threaded
431
378
432
379
433Executable Example-Hair
380Executable Example-Hair
@@ -435,14 +382,14 @@ Executable Example-Hair
435 Default-Extensions: OverloadedStrings
382 Default-Extensions: OverloadedStrings
436 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, transformers, stm-containers, list-t, aeson, path-pieces, either, conduit, http-api-data, template-haskell, ghc, ghc-paths, project-m36
383 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, transformers, stm-containers, list-t, aeson, path-pieces, either, conduit, http-api-data, template-haskell, ghc, ghc-paths, project-m36
437 Main-Is: examples/hair.hs
384 Main-Is: examples/hair.hs
438− GHC-Options: -Wall
385+ GHC-Options: -Wall -threaded
439
386
440Executable Example-CustomTupleable
387Executable Example-CustomTupleable
441 Default-Language: Haskell2010
388 Default-Language: Haskell2010
442 Default-Extensions: OverloadedStrings
389 Default-Extensions: OverloadedStrings
443 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, transformers, stm-containers, list-t, aeson, path-pieces, either, conduit, http-api-data, template-haskell, ghc, ghc-paths, project-m36
390 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, transformers, stm-containers, list-t, aeson, path-pieces, either, conduit, http-api-data, template-haskell, ghc, ghc-paths, project-m36
444 Main-Is: examples/CustomTupleable.hs
391 Main-Is: examples/CustomTupleable.hs
445− GHC-Options: -Wall
392+ GHC-Options: -Wall -threaded
446
393
447Test-Suite test-scripts
394Test-Suite test-scripts
448 Default-Language: Haskell2010
395 Default-Language: Haskell2010
@@ -451,7 +398,7 @@ Test-Suite test-scripts
451 main-is: test/scripts.hs
398 main-is: test/scripts.hs
452 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, network-transport-tcp, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, transformers, stm-containers, list-t, project-m36, random, MonadRandom, semigroups
399 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, network-transport-tcp, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, transformers, stm-containers, list-t, project-m36, random, MonadRandom, semigroups
453 Other-Modules: TutorialD.Interpreter.Base, TutorialD.Interpreter.DatabaseContextExpr, TutorialD.Interpreter.Import.Base, TutorialD.Interpreter.Import.TutorialD, TutorialD.Interpreter.RelationalExpr, TutorialD.Interpreter.Types, TutorialD.Interpreter.Import.BasicExamples
400 Other-Modules: TutorialD.Interpreter.Base, TutorialD.Interpreter.DatabaseContextExpr, TutorialD.Interpreter.Import.Base, TutorialD.Interpreter.Import.TutorialD, TutorialD.Interpreter.RelationalExpr, TutorialD.Interpreter.Types, TutorialD.Interpreter.Import.BasicExamples
454− GHC-Options: -Wall
401+ GHC-Options: -Wall -threaded
455 Hs-Source-Dirs: ., ./src/bin
402 Hs-Source-Dirs: ., ./src/bin
456
403
457Executable project-m36-websocket-server
404Executable project-m36-websocket-server
@@ -459,7 +406,7 @@ Executable project-m36-websocket-server
459 Build-Depends: base, aeson, path-pieces, either, conduit, http-api-data, template-haskell, websockets, aeson, optparse-applicative, project-m36, containers, bytestring, text, vector, uuid, megaparsec, haskeline, mtl, directory, base64-bytestring, random, MonadRandom, time, network-transport-tcp, semigroups, attoparsec
406 Build-Depends: base, aeson, path-pieces, either, conduit, http-api-data, template-haskell, websockets, aeson, optparse-applicative, project-m36, containers, bytestring, text, vector, uuid, megaparsec, haskeline, mtl, directory, base64-bytestring, random, MonadRandom, time, network-transport-tcp, semigroups, attoparsec
460 Main-Is: ProjectM36/Server/WebSocket/websocket-server.hs
407 Main-Is: ProjectM36/Server/WebSocket/websocket-server.hs
461 Other-Modules: ProjectM36.Client.Json, ProjectM36.Server.RemoteCallTypes.Json, ProjectM36.Server.WebSocket, TutorialD.Interpreter, TutorialD.Interpreter.Base, TutorialD.Interpreter.DatabaseContextExpr, TutorialD.Interpreter.DatabaseContextIOOperator, TutorialD.Interpreter.Export.Base, TutorialD.Interpreter.Export.CSV, TutorialD.Interpreter.Import.Base, TutorialD.Interpreter.Import.BasicExamples, TutorialD.Interpreter.Import.CSV, TutorialD.Interpreter.Import.TutorialD, TutorialD.Interpreter.InformationOperator, TutorialD.Interpreter.RODatabaseContextOperator, TutorialD.Interpreter.RelationalExpr, TutorialD.Interpreter.TransactionGraphOperator, TutorialD.Interpreter.Types, TutorialD.Interpreter.TransGraphRelationalOperator, TutorialD.Interpreter.SchemaOperator
408 Other-Modules: ProjectM36.Client.Json, ProjectM36.Server.RemoteCallTypes.Json, ProjectM36.Server.WebSocket, TutorialD.Interpreter, TutorialD.Interpreter.Base, TutorialD.Interpreter.DatabaseContextExpr, TutorialD.Interpreter.DatabaseContextIOOperator, TutorialD.Interpreter.Export.Base, TutorialD.Interpreter.Export.CSV, TutorialD.Interpreter.Import.Base, TutorialD.Interpreter.Import.BasicExamples, TutorialD.Interpreter.Import.CSV, TutorialD.Interpreter.Import.TutorialD, TutorialD.Interpreter.InformationOperator, TutorialD.Interpreter.RODatabaseContextOperator, TutorialD.Interpreter.RelationalExpr, TutorialD.Interpreter.TransactionGraphOperator, TutorialD.Interpreter.Types, TutorialD.Interpreter.TransGraphRelationalOperator, TutorialD.Interpreter.SchemaOperator
462− GHC-Options: -Wall
409+ GHC-Options: -Wall -threaded
463 Hs-Source-Dirs: ./src/bin
410 Hs-Source-Dirs: ./src/bin
464 Default-Extensions: OverloadedStrings
411 Default-Extensions: OverloadedStrings
465
412
@@ -470,7 +417,7 @@ Test-Suite test-websocket-server
470 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, transformers, stm-containers, list-t, websockets, optparse-applicative, network, aeson, project-m36, random, MonadRandom, network-transport-tcp, semigroups
417 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, transformers, stm-containers, list-t, websockets, optparse-applicative, network, aeson, project-m36, random, MonadRandom, network-transport-tcp, semigroups
471 Other-Modules: TutorialD.Interpreter.Export.Base, TutorialD.Interpreter.Export.CSV, TutorialD.Interpreter.Import.BasicExamples, TutorialD.Interpreter.Import.CSV, TutorialD.Interpreter.InformationOperator, TutorialD.Interpreter.RODatabaseContextOperator, TutorialD.Interpreter.TransactionGraphOperator, ProjectM36.Client.Json, ProjectM36.Server.RemoteCallTypes.Json, ProjectM36.Server.WebSocket, TutorialD.Interpreter, TutorialD.Interpreter.Base, TutorialD.Interpreter.DatabaseContextExpr, TutorialD.Interpreter.Import.Base, TutorialD.Interpreter.Import.TutorialD, TutorialD.Interpreter.RelationalExpr, TutorialD.Interpreter.Types, TutorialD.Interpreter.DatabaseContextIOOperator, TutorialD.Interpreter.TransGraphRelationalOperator, TutorialD.Interpreter.SchemaOperator
418 Other-Modules: TutorialD.Interpreter.Export.Base, TutorialD.Interpreter.Export.CSV, TutorialD.Interpreter.Import.BasicExamples, TutorialD.Interpreter.Import.CSV, TutorialD.Interpreter.InformationOperator, TutorialD.Interpreter.RODatabaseContextOperator, TutorialD.Interpreter.TransactionGraphOperator, ProjectM36.Client.Json, ProjectM36.Server.RemoteCallTypes.Json, ProjectM36.Server.WebSocket, TutorialD.Interpreter, TutorialD.Interpreter.Base, TutorialD.Interpreter.DatabaseContextExpr, TutorialD.Interpreter.Import.Base, TutorialD.Interpreter.Import.TutorialD, TutorialD.Interpreter.RelationalExpr, TutorialD.Interpreter.Types, TutorialD.Interpreter.DatabaseContextIOOperator, TutorialD.Interpreter.TransGraphRelationalOperator, TutorialD.Interpreter.SchemaOperator
472 Default-Extensions: OverloadedStrings
419 Default-Extensions: OverloadedStrings
473− GHC-Options: -Wall
420+ GHC-Options: -Wall -threaded
474 Hs-Source-Dirs: ./src/bin, .
421 Hs-Source-Dirs: ./src/bin, .
475
422
476Test-Suite test-isomorphic-schemas
423Test-Suite test-isomorphic-schemas
@@ -479,7 +426,7 @@ Test-Suite test-isomorphic-schemas
479 main-is: test/IsomorphicSchema.hs
426 main-is: test/IsomorphicSchema.hs
480 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, transformers, stm-containers, list-t, websockets, optparse-applicative, network, aeson, project-m36
427 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, transformers, stm-containers, list-t, websockets, optparse-applicative, network, aeson, project-m36
481 Default-Extensions: OverloadedStrings
428 Default-Extensions: OverloadedStrings
482− GHC-Options: -Wall
429+ GHC-Options: -Wall -threaded
483 Hs-Source-Dirs: ./src/bin, .
430 Hs-Source-Dirs: ./src/bin, .
484
431
485Test-Suite test-atomable
432Test-Suite test-atomable
@@ -489,7 +436,7 @@ Test-Suite test-atomable
489 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, transformers, stm-containers, list-t, websockets, optparse-applicative, network, aeson, project-m36, random, MonadRandom, semigroups
436 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, transformers, stm-containers, list-t, websockets, optparse-applicative, network, aeson, project-m36, random, MonadRandom, semigroups
490 Other-Modules: TutorialD.Interpreter, TutorialD.Interpreter.Base, TutorialD.Interpreter.DatabaseContextExpr, TutorialD.Interpreter.DatabaseContextIOOperator, TutorialD.Interpreter.Export.Base, TutorialD.Interpreter.Export.CSV, TutorialD.Interpreter.Import.Base, TutorialD.Interpreter.Import.BasicExamples, TutorialD.Interpreter.Import.CSV, TutorialD.Interpreter.Import.TutorialD, TutorialD.Interpreter.InformationOperator, TutorialD.Interpreter.RODatabaseContextOperator, TutorialD.Interpreter.RelationalExpr, TutorialD.Interpreter.SchemaOperator, TutorialD.Interpreter.TestBase, TutorialD.Interpreter.TransGraphRelationalOperator, TutorialD.Interpreter.TransactionGraphOperator, TutorialD.Interpreter.Types
437 Other-Modules: TutorialD.Interpreter, TutorialD.Interpreter.Base, TutorialD.Interpreter.DatabaseContextExpr, TutorialD.Interpreter.DatabaseContextIOOperator, TutorialD.Interpreter.Export.Base, TutorialD.Interpreter.Export.CSV, TutorialD.Interpreter.Import.Base, TutorialD.Interpreter.Import.BasicExamples, TutorialD.Interpreter.Import.CSV, TutorialD.Interpreter.Import.TutorialD, TutorialD.Interpreter.InformationOperator, TutorialD.Interpreter.RODatabaseContextOperator, TutorialD.Interpreter.RelationalExpr, TutorialD.Interpreter.SchemaOperator, TutorialD.Interpreter.TestBase, TutorialD.Interpreter.TransGraphRelationalOperator, TutorialD.Interpreter.TransactionGraphOperator, TutorialD.Interpreter.Types
491 Default-Extensions: OverloadedStrings
438 Default-Extensions: OverloadedStrings
492− GHC-Options: -Wall
439+ GHC-Options: -Wall -threaded
493 Hs-Source-Dirs: ./src/bin, ., test/
440 Hs-Source-Dirs: ./src/bin, ., test/
494
441
495Test-Suite test-multiprocess-access
442Test-Suite test-multiprocess-access
@@ -498,7 +445,7 @@ Test-Suite test-multiprocess-access
498 main-is: test/MultiProcessDatabaseAccess.hs
445 main-is: test/MultiProcessDatabaseAccess.hs
499 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, transformers, stm-containers, list-t, websockets, optparse-applicative, network, aeson, project-m36, random, MonadRandom
446 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, transformers, stm-containers, list-t, websockets, optparse-applicative, network, aeson, project-m36, random, MonadRandom
500 Default-Extensions: OverloadedStrings
447 Default-Extensions: OverloadedStrings
501− GHC-Options: -Wall
448+ GHC-Options: -Wall -threaded
502 Hs-Source-Dirs: ./src/bin, ., test/
449 Hs-Source-Dirs: ./src/bin, ., test/
503
450
504Test-Suite test-transactiongraph-automerge
451Test-Suite test-transactiongraph-automerge
@@ -508,7 +455,7 @@ Test-Suite test-transactiongraph-automerge
508 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, transformers, stm-containers, list-t, websockets, optparse-applicative, network, aeson, project-m36, random, MonadRandom, semigroups
455 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, transformers, stm-containers, list-t, websockets, optparse-applicative, network, aeson, project-m36, random, MonadRandom, semigroups
509 Other-Modules: TutorialD.Interpreter, TutorialD.Interpreter.Base, TutorialD.Interpreter.DatabaseContextExpr, TutorialD.Interpreter.DatabaseContextIOOperator, TutorialD.Interpreter.Export.Base, TutorialD.Interpreter.Export.CSV, TutorialD.Interpreter.Import.Base, TutorialD.Interpreter.Import.BasicExamples, TutorialD.Interpreter.Import.CSV, TutorialD.Interpreter.Import.TutorialD, TutorialD.Interpreter.InformationOperator, TutorialD.Interpreter.RODatabaseContextOperator, TutorialD.Interpreter.RelationalExpr, TutorialD.Interpreter.SchemaOperator, TutorialD.Interpreter.TestBase, TutorialD.Interpreter.TransGraphRelationalOperator, TutorialD.Interpreter.TransactionGraphOperator, TutorialD.Interpreter.Types
456 Other-Modules: TutorialD.Interpreter, TutorialD.Interpreter.Base, TutorialD.Interpreter.DatabaseContextExpr, TutorialD.Interpreter.DatabaseContextIOOperator, TutorialD.Interpreter.Export.Base, TutorialD.Interpreter.Export.CSV, TutorialD.Interpreter.Import.Base, TutorialD.Interpreter.Import.BasicExamples, TutorialD.Interpreter.Import.CSV, TutorialD.Interpreter.Import.TutorialD, TutorialD.Interpreter.InformationOperator, TutorialD.Interpreter.RODatabaseContextOperator, TutorialD.Interpreter.RelationalExpr, TutorialD.Interpreter.SchemaOperator, TutorialD.Interpreter.TestBase, TutorialD.Interpreter.TransGraphRelationalOperator, TutorialD.Interpreter.TransactionGraphOperator, TutorialD.Interpreter.Types
510 Default-Extensions: OverloadedStrings
457 Default-Extensions: OverloadedStrings
511− GHC-Options: -Wall
458+ GHC-Options: -Wall -threaded
512 Hs-Source-Dirs: ./src/bin, ., test/
459 Hs-Source-Dirs: ./src/bin, ., test/
513
460
514Test-Suite test-tupleable
461Test-Suite test-tupleable
@@ -517,7 +464,7 @@ Test-Suite test-tupleable
517 main-is: test/Relation/Tupleable.hs
464 main-is: test/Relation/Tupleable.hs
518 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, transformers, stm-containers, list-t, websockets, optparse-applicative, network, aeson, project-m36, random, MonadRandom, semigroups
465 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, transformers, stm-containers, list-t, websockets, optparse-applicative, network, aeson, project-m36, random, MonadRandom, semigroups
519 Default-Extensions: OverloadedStrings
466 Default-Extensions: OverloadedStrings
520− GHC-Options: -Wall
467+ GHC-Options: -Wall -threaded
521 Hs-Source-Dirs: ./src/bin, ., test/
468 Hs-Source-Dirs: ./src/bin, ., test/
522
469
523Test-Suite test-client-simple
470Test-Suite test-client-simple
@@ -526,7 +473,7 @@ Test-Suite test-client-simple
526 type: exitcode-stdio-1.0
473 type: exitcode-stdio-1.0
527 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, transformers, stm-containers, list-t, websockets, optparse-applicative, network, aeson, project-m36, random, MonadRandom, semigroups
474 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, transformers, stm-containers, list-t, websockets, optparse-applicative, network, aeson, project-m36, random, MonadRandom, semigroups
528 Default-Extensions: OverloadedStrings
475 Default-Extensions: OverloadedStrings
529− GHC-Options: -Wall
476+ GHC-Options: -Wall -threaded
530 Hs-Source-Dirs: ./src/bin, ., test/
477 Hs-Source-Dirs: ./src/bin, ., test/
531
478
532-- test for file handle leaks
479-- test for file handle leaks
src/bin/ProjectM36/Server/WebSocket.hs+1−1
@@ -14,7 +14,7 @@ import ProjectM36.Relation.Show.Term
14import ProjectM36.Relation.Show.HTML
14import ProjectM36.Relation.Show.HTML
15import Data.Aeson
15import Data.Aeson
16import TutorialD.Interpreter
16import TutorialD.Interpreter
17−import TutorialD.Interpreter.Base
17+import TutorialD.Interpreter.Base (TutorialDOperatorResult(..))
18import ProjectM36.Client
18import ProjectM36.Client
19import Control.Exception
19import Control.Exception
20import Data.Attoparsec.Text
20import Data.Attoparsec.Text
src/bin/ProjectM36/Server/WebSocket/websocket-server.hs+2
@@ -5,11 +5,13 @@ import ProjectM36.Server.ParseArgs
5import ProjectM36.Server
5import ProjectM36.Server
6import Control.Concurrent
6import Control.Concurrent
7import qualified Network.WebSockets as WS
7import qualified Network.WebSockets as WS
8+
8#if MIN_VERSION_network_transport_tcp(0,6,0)
9#if MIN_VERSION_network_transport_tcp(0,6,0)
9import Network.Transport.TCP.Internal (decodeEndPointAddress)
10import Network.Transport.TCP.Internal (decodeEndPointAddress)
10#else
11#else
11import Network.Transport.TCP (decodeEndPointAddress)
12import Network.Transport.TCP (decodeEndPointAddress)
12#endif
13#endif
14+
13import Control.Exception
15import Control.Exception
14
16
15main :: IO ()
17main :: IO ()
src/bin/TutorialD/Interpreter.hs+2−4
@@ -24,8 +24,6 @@ import ProjectM36.TransactionGraph
24import qualified ProjectM36.Client as C
24import qualified ProjectM36.Client as C
25import ProjectM36.Relation (attributes)
25import ProjectM36.Relation (attributes)
26
26
27−import Text.Megaparsec
28−import Text.Megaparsec.Text
29import System.Console.Haskeline
27import System.Console.Haskeline
30import System.Directory (getHomeDirectory)
28import System.Directory (getHomeDirectory)
31import qualified Data.Text as T
29import qualified Data.Text as T
@@ -79,11 +77,11 @@ promptText eHeadName eSchemaName = "TutorialD (" <> transInfo <> "): "
79 where
77 where
80 transInfo = either (const "<unknown>") id eHeadName <> "/" <> either (const "<no schema>") id eSchemaName
78 transInfo = either (const "<unknown>") id eHeadName <> "/" <> either (const "<no schema>") id eSchemaName
81
79
82−parseTutorialD :: T.Text -> Either (ParseError Char Dec) ParsedOperation
80+parseTutorialD :: T.Text -> Either ParserError ParsedOperation
83parseTutorialD = parse interpreterParserP ""
81parseTutorialD = parse interpreterParserP ""
84
82
85--only parse tutoriald which doesn't result in file I/O
83--only parse tutoriald which doesn't result in file I/O
86−safeParseTutorialD :: T.Text -> Either (ParseError Char Dec) ParsedOperation
84+safeParseTutorialD :: T.Text -> Either ParserError ParsedOperation
87safeParseTutorialD = parse safeInterpreterParserP ""
85safeParseTutorialD = parse safeInterpreterParserP ""
88
86
89data SafeEvaluationFlag = SafeEvaluation | UnsafeEvaluation deriving (Eq)
87data SafeEvaluationFlag = SafeEvaluation | UnsafeEvaluation deriving (Eq)
src/bin/TutorialD/Interpreter/Base.hs+44−10
@@ -1,12 +1,30 @@
1{-# LANGUAGE DeriveGeneric, CPP #-}
1{-# LANGUAGE DeriveGeneric, CPP #-}
2−module TutorialD.Interpreter.Base where
2+module TutorialD.Interpreter.Base (
3+ module TutorialD.Interpreter.Base,
4+ module Text.Megaparsec,
5+#if MIN_VERSION_megaparsec(6,0,0)
6+ module Text.Megaparsec.Char,
7+ module Control.Applicative
8+#else
9+ module Text.Megaparsec.Text
10+#endif
11+ )
12+ where
3import ProjectM36.Base
13import ProjectM36.Base
4import ProjectM36.AtomType
14import ProjectM36.AtomType
5import ProjectM36.Relation
15import ProjectM36.Relation
6
16
17+#if MIN_VERSION_megaparsec(6,0,0)
18+import Text.Megaparsec.Char
19+import qualified Text.Megaparsec.Char.Lexer as Lex
7import Text.Megaparsec
20import Text.Megaparsec
21+import Data.Void
22+import Control.Applicative hiding (many, some)
23+#else
8import Text.Megaparsec.Text
24import Text.Megaparsec.Text
9import qualified Text.Megaparsec.Lexer as Lex
25import qualified Text.Megaparsec.Lexer as Lex
26+#endif
27+
10import Data.Text hiding (count)
28import Data.Text hiding (count)
11import System.Random
29import System.Random
12import qualified Data.Text as T
30import qualified Data.Text as T
@@ -44,16 +62,23 @@ displayOpResult (DisplayParseErrorResult mPromptLength err) = do
44displayOpResult (DisplayDataFrameResult dFrame) = do
62displayOpResult (DisplayDataFrameResult dFrame) = do
45 TIO.putStrLn (showRelation $ fromDataFrame dFrame)
63 TIO.putStrLn (showRelation $ fromDataFrame dFrame)
46
64
65+#if MIN_VERSION_megaparsec(6,0,0)
66+type Parser = Parsec Void Text
67+type ParseStr = Text
68+#else
69+type ParseStr = String
70+#endif
71+
47spaceConsumer :: Parser ()
72spaceConsumer :: Parser ()
48spaceConsumer = Lex.space (void spaceChar) (Lex.skipLineComment "--") (Lex.skipBlockComment "{-" "-}")
73spaceConsumer = Lex.space (void spaceChar) (Lex.skipLineComment "--") (Lex.skipBlockComment "{-" "-}")
49
74
50opChar :: Parser Char
75opChar :: Parser Char
51opChar = oneOf (":!#$%&*+./<=>?\\^|-~" :: String)-- remove "@" so it can be used as attribute marker without spaces
76opChar = oneOf (":!#$%&*+./<=>?\\^|-~" :: String)-- remove "@" so it can be used as attribute marker without spaces
52
77
53−reserved :: String -> Parser ()
78+reserved :: ParseStr -> Parser ()
54reserved word = try (string word *> notFollowedBy opChar *> spaceConsumer)
79reserved word = try (string word *> notFollowedBy opChar *> spaceConsumer)
55
80
56−reservedOp :: String -> Parser ()
81+reservedOp :: ParseStr -> Parser ()
57reservedOp op = try (spaceConsumer *> string op *> notFollowedBy opChar *> spaceConsumer)
82reservedOp op = try (spaceConsumer *> string op *> notFollowedBy opChar *> spaceConsumer)
58
83
59parens :: Parser a -> Parser a
84parens :: Parser a -> Parser a
@@ -69,8 +94,12 @@ identifier = do
69 spaceConsumer
94 spaceConsumer
70 pure (pack (istart:irest))
95 pure (pack (istart:irest))
71
96
72−symbol :: String -> Parser Text
97+symbol :: ParseStr -> Parser Text
98+#if MIN_VERSION_megaparsec(6,0,0)
99+symbol sym = Lex.symbol spaceConsumer sym
100+#else
73symbol sym = pack <$> Lex.symbol spaceConsumer sym
101symbol sym = pack <$> Lex.symbol spaceConsumer sym
102+#endif
74
103
75comma :: Parser Text
104comma :: Parser Text
76comma = symbol ","
105comma = symbol ","
@@ -90,13 +119,12 @@ arrow = symbol "->"
90semi :: Parser Text
119semi :: Parser Text
91semi = symbol ";"
120semi = symbol ";"
92
121
93−{-
94−whiteSpace :: Parser ()
95−whiteSpace = Token.whiteSpace lexer
96−-}
97−
98integer :: Parser Integer
122integer :: Parser Integer
123+#if MIN_VERSION_megaparsec(6,0,0)
124+integer = Lex.signed spaceConsumer Lex.decimal
125+#else
99integer = Lex.signed spaceConsumer Lex.integer
126integer = Lex.signed spaceConsumer Lex.integer
127+#endif
100
128
101float :: Parser Double
129float :: Parser Double
102float = Lex.float
130float = Lex.float
@@ -125,13 +153,19 @@ showRelationAttributes attrs = "{" <> T.concat (L.intersperse ", " $ L.map showA
125
153
126type PromptLength = Int
154type PromptLength = Int
127
155
156+#if MIN_VERSION_megaparsec(6,0,0)
157+type ParserError = ParseError Char Void
158+#else
159+type ParserError = ParseError Char Dec
160+#endif
161+
128data TutorialDOperatorResult = QuitResult |
162data TutorialDOperatorResult = QuitResult |
129 DisplayResult StringType |
163 DisplayResult StringType |
130 DisplayIOResult (IO ()) |
164 DisplayIOResult (IO ()) |
131 DisplayRelationResult Relation |
165 DisplayRelationResult Relation |
132 DisplayDataFrameResult DataFrame |
166 DisplayDataFrameResult DataFrame |
133 DisplayErrorResult StringType |
167 DisplayErrorResult StringType |
134− DisplayParseErrorResult (Maybe PromptLength) (ParseError Char Dec) | -- Int refers to length of prompt text
168+ DisplayParseErrorResult (Maybe PromptLength) ParserError | -- PromptLength refers to length of prompt text
135 QuietSuccessResult
169 QuietSuccessResult
136 deriving (Generic)
170 deriving (Generic)
137
171
src/bin/TutorialD/Interpreter/DatabaseContextExpr.hs−2
@@ -1,6 +1,4 @@
1module TutorialD.Interpreter.DatabaseContextExpr where
1module TutorialD.Interpreter.DatabaseContextExpr where
2−import Text.Megaparsec
3−import Text.Megaparsec.Text
4import ProjectM36.Base
2import ProjectM36.Base
5import TutorialD.Interpreter.Base
3import TutorialD.Interpreter.Base
6import qualified Data.Text as T
4import qualified Data.Text as T
src/bin/TutorialD/Interpreter/DatabaseContextIOOperator.hs+1−4
@@ -1,11 +1,8 @@
1--compiling the script requires the IO monad because it must load modules from the filesystem, so we create the function and generate the requisite DatabaseExpr here.
1--compiling the script requires the IO monad because it must load modules from the filesystem, so we create the function and generate the requisite DatabaseExpr here.
2module TutorialD.Interpreter.DatabaseContextIOOperator where
2module TutorialD.Interpreter.DatabaseContextIOOperator where
3import ProjectM36.Base
3import ProjectM36.Base
4−
5import TutorialD.Interpreter.Base
4import TutorialD.Interpreter.Base
6import TutorialD.Interpreter.Types
5import TutorialD.Interpreter.Types
7−import Text.Megaparsec
8−import Text.Megaparsec.Text
9import Data.Text
6import Data.Text
10
7
11addAtomFunctionExprP :: Parser DatabaseContextIOExpr
8addAtomFunctionExprP :: Parser DatabaseContextIOExpr
@@ -24,7 +21,7 @@ createArbitraryRelationP = do
24 max' <- fromInteger <$> integer
21 max' <- fromInteger <$> integer
25 pure $ CreateArbitraryRelation relVarName attrExprs (min',max')
22 pure $ CreateArbitraryRelation relVarName attrExprs (min',max')
26
23
27−dbioexprP :: String -> (Text -> [TypeConstructor] -> Text -> DatabaseContextIOExpr) -> Parser DatabaseContextIOExpr
24+dbioexprP :: ParseStr -> (Text -> [TypeConstructor] -> Text -> DatabaseContextIOExpr) -> Parser DatabaseContextIOExpr
28dbioexprP res adt = do
25dbioexprP res adt = do
29 reserved res
26 reserved res
30 funcName <- quotedString
27 funcName <- quotedString
src/bin/TutorialD/Interpreter/Export/CSV.hs+1−2
@@ -2,10 +2,9 @@ module TutorialD.Interpreter.Export.CSV where
2import ProjectM36.Relation.Show.CSV
2import ProjectM36.Relation.Show.CSV
3import TutorialD.Interpreter.Export.Base
3import TutorialD.Interpreter.Export.Base
4import TutorialD.Interpreter.RelationalExpr
4import TutorialD.Interpreter.RelationalExpr
5−import TutorialD.Interpreter.Base
5+import TutorialD.Interpreter.Base hiding (try)
6import ProjectM36.Base
6import ProjectM36.Base
7import ProjectM36.Error
7import ProjectM36.Error
8−import Text.Megaparsec.Text
9import qualified Data.ByteString.Lazy as BS
8import qualified Data.ByteString.Lazy as BS
10import Control.Exception (try)
9import Control.Exception (try)
11import qualified Data.Text as T
10import qualified Data.Text as T
src/bin/TutorialD/Interpreter/Import/BasicExamples.hs+4
@@ -1,10 +1,14 @@
1+{-# LANGUAGE CPP #-}
1--includes some hardcoded examples which can be imported even during safe evaluation (no file I/O)
2--includes some hardcoded examples which can be imported even during safe evaluation (no file I/O)
2module TutorialD.Interpreter.Import.BasicExamples where
3module TutorialD.Interpreter.Import.BasicExamples where
3import ProjectM36.DateExamples
4import ProjectM36.DateExamples
4import ProjectM36.Base
5import ProjectM36.Base
5import ProjectM36.DatabaseContext
6import ProjectM36.DatabaseContext
6import TutorialD.Interpreter.Base
7import TutorialD.Interpreter.Base
8+
9+#if !MIN_VERSION_megaparsec(6,0,0)
7import Text.Megaparsec.Text
10import Text.Megaparsec.Text
11+#endif
8
12
9data ImportBasicExampleOperator = ImportBasicDateExampleOperator
13data ImportBasicExampleOperator = ImportBasicDateExampleOperator
10 deriving (Show)
14 deriving (Show)
src/bin/TutorialD/Interpreter/Import/CSV.hs+2−2
@@ -1,3 +1,4 @@
1+{-# LANGUAGE CPP #-}
1module TutorialD.Interpreter.Import.CSV where
2module TutorialD.Interpreter.Import.CSV where
2import TutorialD.Interpreter.Import.Base
3import TutorialD.Interpreter.Import.Base
3import ProjectM36.Base
4import ProjectM36.Base
@@ -5,8 +6,7 @@ import ProjectM36.Error
5import ProjectM36.Relation.Parse.CSV hiding (quotedString)
6import ProjectM36.Relation.Parse.CSV hiding (quotedString)
6import qualified Data.ByteString.Lazy as BS
7import qualified Data.ByteString.Lazy as BS
7import qualified Data.Text as T
8import qualified Data.Text as T
8−import Text.Megaparsec.Text
9−import TutorialD.Interpreter.Base
9+import TutorialD.Interpreter.Base hiding (try)
10import Control.Exception
10import Control.Exception
11
11
12importCSVRelation :: RelVarName -> TypeConstructorMapping -> Attributes -> FilePath -> IO (Either RelationalError DatabaseContextExpr)
12importCSVRelation :: RelVarName -> TypeConstructorMapping -> Attributes -> FilePath -> IO (Either RelationalError DatabaseContextExpr)
src/bin/TutorialD/Interpreter/Import/TutorialD.hs+1−3
@@ -1,10 +1,8 @@
1module TutorialD.Interpreter.Import.TutorialD where
1module TutorialD.Interpreter.Import.TutorialD where
2import ProjectM36.Base
2import ProjectM36.Base
3import TutorialD.Interpreter.Import.Base
3import TutorialD.Interpreter.Import.Base
4−import TutorialD.Interpreter.Base
4+import TutorialD.Interpreter.Base hiding (try)
5import TutorialD.Interpreter.DatabaseContextExpr
5import TutorialD.Interpreter.DatabaseContextExpr
6−import Text.Megaparsec.Text
7−import Text.Megaparsec hiding (try)
8import ProjectM36.Error
6import ProjectM36.Error
9import qualified ProjectM36.Error as PM36E
7import qualified ProjectM36.Error as PM36E
10import qualified Data.Text as T
8import qualified Data.Text as T
src/bin/TutorialD/Interpreter/InformationOperator.hs−1
@@ -2,7 +2,6 @@
2module TutorialD.Interpreter.InformationOperator where
2module TutorialD.Interpreter.InformationOperator where
3import Data.Text
3import Data.Text
4import Text.Megaparsec
4import Text.Megaparsec
5−import Text.Megaparsec.Text
6import TutorialD.Interpreter.Base
5import TutorialD.Interpreter.Base
7-- older versions of stack fail to
6-- older versions of stack fail to
8#if !defined(VERSION_project_m36)
7#if !defined(VERSION_project_m36)
src/bin/TutorialD/Interpreter/RODatabaseContextOperator.hs−2
@@ -7,8 +7,6 @@ import ProjectM36.Relation (attributes)
7import ProjectM36.Error
7import ProjectM36.Error
8import ProjectM36.InclusionDependency
8import ProjectM36.InclusionDependency
9import qualified ProjectM36.Client as C
9import qualified ProjectM36.Client as C
10−import Text.Megaparsec
11−import Text.Megaparsec.Text
12import TutorialD.Interpreter.Base
10import TutorialD.Interpreter.Base
13import TutorialD.Interpreter.RelationalExpr
11import TutorialD.Interpreter.RelationalExpr
14import TutorialD.Interpreter.DatabaseContextExpr
12import TutorialD.Interpreter.DatabaseContextExpr
src/bin/TutorialD/Interpreter/RelationalExpr.hs−1
@@ -2,7 +2,6 @@ module TutorialD.Interpreter.RelationalExpr where
2import Text.Megaparsec
2import Text.Megaparsec
3import Text.Megaparsec.Expr
3import Text.Megaparsec.Expr
4import ProjectM36.Base
4import ProjectM36.Base
5−import Text.Megaparsec.Text
6import TutorialD.Interpreter.Base
5import TutorialD.Interpreter.Base
7import TutorialD.Interpreter.Types
6import TutorialD.Interpreter.Types
8import qualified Data.Text as T
7import qualified Data.Text as T
src/bin/TutorialD/Interpreter/SchemaOperator.hs−2
@@ -1,7 +1,5 @@
1module TutorialD.Interpreter.SchemaOperator where
1module TutorialD.Interpreter.SchemaOperator where
2import Text.Megaparsec
2import Text.Megaparsec
3−import Text.Megaparsec.Text
4−
5import ProjectM36.Base
3import ProjectM36.Base
6import ProjectM36.IsomorphicSchema
4import ProjectM36.IsomorphicSchema
7import ProjectM36.Session
5import ProjectM36.Session
src/bin/TutorialD/Interpreter/TransGraphRelationalOperator.hs−3
@@ -9,9 +9,6 @@ import qualified ProjectM36.Client as C
9import TutorialD.Interpreter.Base
9import TutorialD.Interpreter.Base
10import TutorialD.Interpreter.RelationalExpr
10import TutorialD.Interpreter.RelationalExpr
11
11
12−import Text.Megaparsec
13−import Text.Megaparsec.Text
14−
15import qualified Data.Text as T
12import qualified Data.Text as T
16
13
17instance RelationalMarkerExpr TransactionIdLookup where
14instance RelationalMarkerExpr TransactionIdLookup where
src/bin/TutorialD/Interpreter/TransactionGraphOperator.hs−2
@@ -1,8 +1,6 @@
1{-# LANGUAGE GADTs #-}
1{-# LANGUAGE GADTs #-}
2module TutorialD.Interpreter.TransactionGraphOperator where
2module TutorialD.Interpreter.TransactionGraphOperator where
3import TutorialD.Interpreter.Base
3import TutorialD.Interpreter.Base
4−import Text.Megaparsec.Text
5−import Text.Megaparsec
6import ProjectM36.TransactionGraph hiding (autoMergeToHead)
4import ProjectM36.TransactionGraph hiding (autoMergeToHead)
7import ProjectM36.Client
5import ProjectM36.Client
8import ProjectM36.Base
6import ProjectM36.Base
src/bin/TutorialD/Interpreter/Types.hs+3−7
@@ -1,7 +1,6 @@
1--parse type and data constructors
1--parse type and data constructors
2module TutorialD.Interpreter.Types where
2module TutorialD.Interpreter.Types where
3import ProjectM36.Base
3import ProjectM36.Base
4−import Text.Megaparsec.Text
5import Text.Megaparsec
4import Text.Megaparsec
6import TutorialD.Interpreter.Base
5import TutorialD.Interpreter.Base
7
6
@@ -25,8 +24,7 @@ dataConstructorDefP = DataConstructorDef <$> capitalizedIdentifier <*> many data
25
24
26-- data *Either a b* = Left *a* | Right *b*
25-- data *Either a b* = Left *a* | Right *b*
27dataConstructorDefArgP :: Parser DataConstructorDefArg
26dataConstructorDefArgP :: Parser DataConstructorDefArg
28−dataConstructorDefArgP = parens (DataConstructorDefTypeConstructorArg <$> typeConstructorP) <|>
27+dataConstructorDefArgP = DataConstructorDefTypeConstructorArg <$> (monoTypeConstructorP <|> parens typeConstructorP) <|>
29− DataConstructorDefTypeConstructorArg <$> typeConstructorP <|>
30 DataConstructorDefTypeVarNameArg <$> uncapitalizedIdentifier
28 DataConstructorDefTypeVarNameArg <$> uncapitalizedIdentifier
31
29
32-- relation{a Int} in type construction (no tuples parsed)
30-- relation{a Int} in type construction (no tuples parsed)
@@ -41,14 +39,12 @@ makeAttributeExprsP = braces (sepBy attributeAndTypeNameP comma)
41
39
42attributeAndTypeNameP :: RelationalMarkerExpr a => Parser (AttributeExprBase a)
40attributeAndTypeNameP :: RelationalMarkerExpr a => Parser (AttributeExprBase a)
43attributeAndTypeNameP = AttributeAndTypeNameExpr <$> identifier <*> typeConstructorP <*> parseMarkerP
41attributeAndTypeNameP = AttributeAndTypeNameExpr <$> identifier <*> typeConstructorP <*> parseMarkerP
44−
45
42
46-- *Either Int Text*, *Int*
43-- *Either Int Text*, *Int*
47typeConstructorP :: Parser TypeConstructor
44typeConstructorP :: Parser TypeConstructor
48typeConstructorP = relationTypeConstructorP <|>
45typeConstructorP = relationTypeConstructorP <|>
49− TypeVariable <$> uncapitalizedIdentifier <|>
50− ADTypeConstructor <$> capitalizedIdentifier <*> many (parens typeConstructorP <|>
46+ ADTypeConstructor <$> capitalizedIdentifier <*> many (monoTypeConstructorP <|> parens typeConstructorP) <|>
51− monoTypeConstructorP)
47+ monoTypeConstructorP
52
48
53monoTypeConstructorP :: Parser TypeConstructor
49monoTypeConstructorP :: Parser TypeConstructor
54monoTypeConstructorP = ADTypeConstructor <$> capitalizedIdentifier <*> pure [] <|>
50monoTypeConstructorP = ADTypeConstructor <$> capitalizedIdentifier <*> pure [] <|>
src/bin/benchmark/Handles.hs+1−2
@@ -4,9 +4,8 @@ import ProjectM36.Client
4import ProjectM36.Persist
4import ProjectM36.Persist
5import Options.Applicative
5import Options.Applicative
6import TutorialD.Interpreter
6import TutorialD.Interpreter
7−import TutorialD.Interpreter.Base
7+import TutorialD.Interpreter.Base hiding (Parser, option)
8import qualified Data.Text as T
8import qualified Data.Text as T
9−import Text.Megaparsec hiding (option)
10import Data.Monoid
9import Data.Monoid
11import Control.Monad
10import Control.Monad
12
11
src/bin/benchmark/bigrel.hs+8−4
@@ -83,10 +83,9 @@ intmapMatrixRelation :: Int -> Int -> HS.HashSet (IM.IntMap Atom)
83intmapMatrixRelation attributeCount tupleCount = HS.fromList $ map mapper [0..tupleCount]
83intmapMatrixRelation attributeCount tupleCount = HS.fromList $ map mapper [0..tupleCount]
84 where
84 where
85 mapper tupCount = IM.fromList $ map (\c-> (c, IntAtom (fromIntegral tupCount))) [0..attributeCount]
85 mapper tupCount = IM.fromList $ map (\c-> (c, IntAtom (fromIntegral tupCount))) [0..attributeCount]
86−
87−instance Hash.Hashable (IM.IntMap Atom) where
88− hashWithSalt salt tupMap = Hash.hashWithSalt salt (show tupMap)
89-}
86-}
87+-- instance Hash.Hashable (IM.IntMap Atom) where
88+-- hashWithSalt salt tupMap = Hash.hashWithSalt salt (show tupMap)
90
89
91{-
90{-
92vectorMatrixRun :: IO ()
91vectorMatrixRun :: IO ()
@@ -94,15 +93,20 @@ vectorMatrixRun = do
94 let matrix = vectorMatrixRelation 100 100000
93 let matrix = vectorMatrixRelation 100 100000
95 print matrix
94 print matrix
96-}
95-}
96+-- 20 s 90 MBs- a clear win- ideal size is 10 * 100000 * 8 bytes = 80 MB! without IntAtom wrapper
97+--with IntAtom wrapper: 1m12s 90 MB
98+{-
99+
97
100
98-- 20 s 90 MBs- a clear win- ideal size is 10 * 100000 * 8 bytes = 80 MB! without IntAtom wrapper
101-- 20 s 90 MBs- a clear win- ideal size is 10 * 100000 * 8 bytes = 80 MB! without IntAtom wrapper
99--with IntAtom wrapper: 1m12s 90 MB
102--with IntAtom wrapper: 1m12s 90 MB
100{-
103{-
104+
101vectorMatrixRelation :: Int -> Int -> HS.HashSet (V.Vector Atom)
105vectorMatrixRelation :: Int -> Int -> HS.HashSet (V.Vector Atom)
102vectorMatrixRelation attributeCount tupleCount = HS.fromList $ map mapper [0..tupleCount]
106vectorMatrixRelation attributeCount tupleCount = HS.fromList $ map mapper [0..tupleCount]
103 where
107 where
104 mapper tupCount = V.replicate attributeCount (IntAtom (fromIntegral tupCount))
108 mapper tupCount = V.replicate attributeCount (IntAtom (fromIntegral tupCount))
105−
109+-}
106instance Hash.Hashable (V.Vector Atom) where
110instance Hash.Hashable (V.Vector Atom) where
107 hashWithSalt salt vec = Hash.hashWithSalt salt (show vec)
111 hashWithSalt salt vec = Hash.hashWithSalt salt (show vec)
108-}
112-}
src/lib/ProjectM36/Arbitrary.hs+2−13
@@ -10,8 +10,9 @@ import ProjectM36.Attribute (atomType)
10import ProjectM36.DataConstructorDef as DCD
10import ProjectM36.DataConstructorDef as DCD
11import ProjectM36.DataTypes.Interval
11import ProjectM36.DataTypes.Interval
12import qualified Data.Vector as V
12import qualified Data.Vector as V
13−import Data.Text (Text,pack)
13+import Data.Text (Text)
14import Test.QuickCheck
14import Test.QuickCheck
15+import Test.QuickCheck.Instances ()
15import qualified Data.ByteString.Char8 as B
16import qualified Data.ByteString.Char8 as B
16import Data.Time
17import Data.Time
17import Control.Monad.Reader
18import Control.Monad.Reader
@@ -75,18 +76,6 @@ maybeToRight :: b -> Maybe a -> Either b a
75maybeToRight _ (Just x) = Right x
76maybeToRight _ (Just x) = Right x
76maybeToRight y Nothing = Left y
77maybeToRight y Nothing = Left y
77
78
78−instance Arbitrary Text where
79− arbitrary = pack <$> elements (map (replicate 3) ['A'..'Z'])
80−
81−instance Arbitrary Day where
82− arbitrary = ModifiedJulianDay <$> (arbitrary :: Gen Integer)
83−
84−instance Arbitrary UTCTime where
85− arbitrary = UTCTime <$> arbitrary <*> (secondsToDiffTime <$> choose(0,86400))
86−
87−instance Arbitrary B.ByteString where
88− arbitrary = B.pack <$> (arbitrary :: Gen String)
89−
90arbitraryRelationTuple :: Attributes -> WithTCMap Gen (Either RelationalError RelationTuple)
79arbitraryRelationTuple :: Attributes -> WithTCMap Gen (Either RelationalError RelationTuple)
91arbitraryRelationTuple attris = do
80arbitraryRelationTuple attris = do
92 tcMap <- ask
81 tcMap <- ask
src/lib/ProjectM36/Atomable.hs+21−7
@@ -4,7 +4,6 @@ module ProjectM36.Atomable where
4--http://stackoverflow.com/questions/13448361/type-families-with-ghc-generics-or-data-data
4--http://stackoverflow.com/questions/13448361/type-families-with-ghc-generics-or-data-data
5--instances to marshal Haskell ADTs to ConstructedAtoms and back
5--instances to marshal Haskell ADTs to ConstructedAtoms and back
6import ProjectM36.Base
6import ProjectM36.Base
7−import ProjectM36.DataTypes.Primitive
8import ProjectM36.DataTypes.List
7import ProjectM36.DataTypes.List
9import ProjectM36.DataTypes.NonEmptyList
8import ProjectM36.DataTypes.NonEmptyList
10import ProjectM36.DataTypes.Maybe
9import ProjectM36.DataTypes.Maybe
@@ -12,13 +11,13 @@ import ProjectM36.DataTypes.Either
12import GHC.Generics
11import GHC.Generics
13import qualified Data.Map as M
12import qualified Data.Map as M
14import qualified Data.Text as T
13import qualified Data.Text as T
14+import qualified Data.Vector as V
15import Control.DeepSeq (NFData)
15import Control.DeepSeq (NFData)
16import Data.Binary
16import Data.Binary
17import Control.Applicative
17import Control.Applicative
18import Data.Time.Calendar
18import Data.Time.Calendar
19import Data.ByteString (ByteString)
19import Data.ByteString (ByteString)
20import Data.Time.Clock
20import Data.Time.Clock
21−import Data.Maybe
22import Data.Proxy
21import Data.Proxy
23import qualified Data.List.NonEmpty as NE
22import qualified Data.List.NonEmpty as NE
24
23
@@ -55,7 +54,7 @@ class (Eq a, NFData a, Binary a, Show a) => Atomable a where
55 toAtomType _ = toAtomTypeG (from (undefined :: a))
54 toAtomType _ = toAtomTypeG (from (undefined :: a))
56
55
57 -- | Creates DatabaseContextExpr necessary to load the type constructor and data constructor into the database.
56 -- | Creates DatabaseContextExpr necessary to load the type constructor and data constructor into the database.
58− toAddTypeExpr :: Proxy a -> DatabaseContextExpr
57+ toAddTypeExpr :: proxy a -> DatabaseContextExpr
59 default toAddTypeExpr :: (Generic a, AtomableG (Rep a)) => proxy a -> DatabaseContextExpr
58 default toAddTypeExpr :: (Generic a, AtomableG (Rep a)) => proxy a -> DatabaseContextExpr
60 toAddTypeExpr _ = toAddTypeExprG (from (undefined :: a)) (toAtomType (Proxy :: Proxy a))
59 toAddTypeExpr _ = toAddTypeExprG (from (undefined :: a)) (toAtomType (Proxy :: Proxy a))
61
60
@@ -242,10 +241,25 @@ instance (Atomable a) => AtomableG (K1 c a) where
242 getConstructorsG = undefined
241 getConstructorsG = undefined
243 getConstructorArgsG (K1 _) = [DataConstructorDefTypeConstructorArg tCons]
242 getConstructorArgsG (K1 _) = [DataConstructorDefTypeConstructorArg tCons]
244 where
243 where
245− tCons = PrimitiveTypeConstructor primitiveATypeName primitiveAType
246− primitiveAType = toAtomType (Proxy :: Proxy a)
244+ tCons = typeToTypeConstructor $ toAtomType (Proxy :: Proxy a)
247− primitiveATypeName = fromMaybe (error ("primitive type missing: " ++ show primitiveAType)) (foldr (\(PrimitiveTypeConstructorDef name typ, _) acc -> if typ == primitiveAType then Just name else acc) Nothing primitiveTypeConstructorMapping)
245+
248−
246+typeToTypeConstructor :: AtomType -> TypeConstructor
247+typeToTypeConstructor x@IntAtomType = PrimitiveTypeConstructor "Int" x
248+typeToTypeConstructor x@IntegerAtomType = PrimitiveTypeConstructor "Integer" x
249+typeToTypeConstructor x@DoubleAtomType = PrimitiveTypeConstructor "Double" x
250+typeToTypeConstructor x@TextAtomType = PrimitiveTypeConstructor "Text" x
251+typeToTypeConstructor x@DayAtomType = PrimitiveTypeConstructor "Day" x
252+typeToTypeConstructor x@DateTimeAtomType = PrimitiveTypeConstructor "DateTime" x
253+typeToTypeConstructor x@ByteStringAtomType = PrimitiveTypeConstructor "ByteString" x
254+typeToTypeConstructor x@BoolAtomType = PrimitiveTypeConstructor "Bool" x
255+typeToTypeConstructor (RelationAtomType attrs)
256+ = RelationAtomTypeConstructor $ map attrToAttrExpr $ V.toList attrs
257+ where
258+ attrToAttrExpr (Attribute n t) = AttributeAndTypeNameExpr n (typeToTypeConstructor t) ()
259+typeToTypeConstructor (ConstructedAtomType tcName tvMap)
260+ = ADTypeConstructor tcName $ map typeToTypeConstructor (M.elems tvMap)
261+typeToTypeConstructor (TypeVariableType tvName) = TypeVariable tvName
262+
249instance AtomableG U1 where
263instance AtomableG U1 where
250 toAtomG = undefined
264 toAtomG = undefined
251 fromAtomG _ _ = pure U1
265 fromAtomG _ _ = pure U1
src/lib/ProjectM36/Client.hs+34−24
@@ -1,4 +1,4 @@
1−{-# LANGUAGE DeriveAnyClass, DeriveGeneric, ScopedTypeVariables, BangPatterns #-}
1+{-# LANGUAGE DeriveAnyClass, DeriveGeneric, ScopedTypeVariables, BangPatterns, PackageImports #-}
2{-|
2{-|
3Module: ProjectM36.Client
3Module: ProjectM36.Client
4
4
@@ -128,6 +128,7 @@ import Control.Exception.Base
128import GHC.Conc.Sync
128import GHC.Conc.Sync
129
129
130import Network.Transport (Transport(closeTransport))
130import Network.Transport (Transport(closeTransport))
131+
131#if MIN_VERSION_network_transport_tcp(0,6,0)
132#if MIN_VERSION_network_transport_tcp(0,6,0)
132import Network.Transport.TCP (createTransport, defaultTCPParameters)
133import Network.Transport.TCP (createTransport, defaultTCPParameters)
133import Network.Transport.TCP.Internal (encodeEndPointAddress)
134import Network.Transport.TCP.Internal (encodeEndPointAddress)
@@ -146,12 +147,17 @@ import Control.Exception (IOException, handle, AsyncException, throwIO, fromExce
146import Control.Concurrent.MVar
147import Control.Concurrent.MVar
147import qualified Data.Map as M
148import qualified Data.Map as M
148import Control.Distributed.Process.Serializable (Serializable)
149import Control.Distributed.Process.Serializable (Serializable)
150+#if MIN_VERSION_stm_containers(1,0,0)
151+import qualified StmContainers.Map as StmMap
152+import qualified StmContainers.Set as StmSet
153+#else
149−import qualified STMContainers.Map as STMMap
154+import qualified STMContainers.Map as StmMap
150−import qualified STMContainers.Set as STMSet
155+import qualified STMContainers.Set as StmSet
156+#endif
151import qualified ProjectM36.Session as Sess
157import qualified ProjectM36.Session as Sess
152import ProjectM36.Session
158import ProjectM36.Session
153import ProjectM36.Sessions
159import ProjectM36.Sessions
154−import ListT
160+import "list-t" ListT
155import Data.Binary (Binary)
161import Data.Binary (Binary)
156import GHC.Generics (Generic)
162import GHC.Generics (Generic)
157import Control.DeepSeq (force)
163import Control.DeepSeq (force)
@@ -223,7 +229,7 @@ defaultRemoteConnectionInfo :: ConnectionInfo
223defaultRemoteConnectionInfo = RemoteProcessConnectionInfo defaultDatabaseName (createNodeId "127.0.0.1" defaultServerPort) emptyNotificationCallback
229defaultRemoteConnectionInfo = RemoteProcessConnectionInfo defaultDatabaseName (createNodeId "127.0.0.1" defaultServerPort) emptyNotificationCallback
224
230
225-- | The 'Connection' represents either local or remote access to a database. All operations flow through the connection.
231-- | The 'Connection' represents either local or remote access to a database. All operations flow through the connection.
226−type ClientNodes = STMSet.Set ProcessId
232+type ClientNodes = StmSet.Set ProcessId
227
233
228-- internal structure specific to in-process connections
234-- internal structure specific to in-process connections
229data InProcessConnectionConf = InProcessConnectionConf {
235data InProcessConnectionConf = InProcessConnectionConf {
@@ -306,8 +312,8 @@ connectProjectM36 (InProcessConnectionInfo strat notificationCallback ghcPkgPath
306 --create date examples graph for now- probably should be empty context in the future
312 --create date examples graph for now- probably should be empty context in the future
307 NoPersistence -> do
313 NoPersistence -> do
308 graphTvar <- newTVarIO freshGraph
314 graphTvar <- newTVarIO freshGraph
309− clientNodes <- STMSet.newIO
315+ clientNodes <- StmSet.newIO
310− sessions <- STMMap.newIO
316+ sessions <- StmMap.newIO
311 (localNode, transport) <- createLocalNode
317 (localNode, transport) <- createLocalNode
312 notificationPid <- startNotificationListener localNode notificationCallback
318 notificationPid <- startNotificationListener localNode notificationCallback
313 mScriptSession <- createScriptSession ghcPkgPaths
319 mScriptSession <- createScriptSession ghcPkgPaths
@@ -363,8 +369,8 @@ connectPersistentProjectM36 strat sync dbdir freshGraph notificationCallback ghc
363 Left err' -> return $ Left (SetupDatabaseDirectoryError err')
369 Left err' -> return $ Left (SetupDatabaseDirectoryError err')
364 Right graph' -> do
370 Right graph' -> do
365 tvarGraph <- newTVarIO graph'
371 tvarGraph <- newTVarIO graph'
366− sessions <- STMMap.newIO
372+ sessions <- StmMap.newIO
367− clientNodes <- STMSet.newIO
373+ clientNodes <- StmSet.newIO
368 (localNode, transport) <- createLocalNode
374 (localNode, transport) <- createLocalNode
369 lockMVar <- newMVar digest
375 lockMVar <- newMVar digest
370 let conn = InProcessConnection InProcessConnectionConf {
376 let conn = InProcessConnection InProcessConnectionConf {
@@ -398,11 +404,11 @@ createSessionAtCommit_ commitId newSessionId (InProcessConnection conf) = do
398 Left err -> pure (Left err)
404 Left err -> pure (Left err)
399 Right transaction -> do
405 Right transaction -> do
400 let freshDiscon = DisconnectedTransaction commitId (Trans.schemas transaction) False
406 let freshDiscon = DisconnectedTransaction commitId (Trans.schemas transaction) False
401− keyDuplication <- STMMap.lookup newSessionId sessions
407+ keyDuplication <- StmMap.lookup newSessionId sessions
402 case keyDuplication of
408 case keyDuplication of
403 Just _ -> pure $ Left (SessionIdInUseError newSessionId)
409 Just _ -> pure $ Left (SessionIdInUseError newSessionId)
404 Nothing -> do
410 Nothing -> do
405− STMMap.insert (Session freshDiscon defaultSchemaName) newSessionId sessions
411+ StmMap.insert (Session freshDiscon defaultSchemaName) newSessionId sessions
406 pure $ Right newSessionId
412 pure $ Right newSessionId
407createSessionAtCommit_ _ _ (RemoteProcessConnection _) = error "createSessionAtCommit_ called on remote connection"
413createSessionAtCommit_ _ _ (RemoteProcessConnection _) = error "createSessionAtCommit_ called on remote connection"
408
414
@@ -421,12 +427,12 @@ createSessionAtHead conn@(RemoteProcessConnection _) headn = remoteCall conn (Cr
421-- | Used internally for server connections to keep track of remote nodes for the purpose of sending notifications later.
427-- | Used internally for server connections to keep track of remote nodes for the purpose of sending notifications later.
422addClientNode :: Connection -> ProcessId -> IO ()
428addClientNode :: Connection -> ProcessId -> IO ()
423addClientNode (RemoteProcessConnection _) _ = error "addClientNode called on remote connection"
429addClientNode (RemoteProcessConnection _) _ = error "addClientNode called on remote connection"
424−addClientNode (InProcessConnection conf) newProcessId = atomically (STMSet.insert newProcessId (ipClientNodes conf))
430+addClientNode (InProcessConnection conf) newProcessId = atomically (StmSet.insert newProcessId (ipClientNodes conf))
425
431
426-- | Discards a session, eliminating any uncommitted changes present in the session.
432-- | Discards a session, eliminating any uncommitted changes present in the session.
427closeSession :: SessionId -> Connection -> IO ()
433closeSession :: SessionId -> Connection -> IO ()
428closeSession sessionId (InProcessConnection conf) =
434closeSession sessionId (InProcessConnection conf) =
429− atomically $ STMMap.delete sessionId (ipSessions conf)
435+ atomically $ StmMap.delete sessionId (ipSessions conf)
430closeSession sessionId conn@(RemoteProcessConnection _) = remoteCall conn (CloseSession sessionId)
436closeSession sessionId conn@(RemoteProcessConnection _) = remoteCall conn (CloseSession sessionId)
431
437
432-- | 'close' cleans up the database access connection and closes any relevant sockets.
438-- | 'close' cleans up the database access connection and closes any relevant sockets.
@@ -434,7 +440,11 @@ close :: Connection -> IO ()
434close (InProcessConnection conf) = do
440close (InProcessConnection conf) = do
435 atomically $ do
441 atomically $ do
436 let sessions = ipSessions conf
442 let sessions = ipSessions conf
443+#if MIN_VERSION_stm_containers(1,0,0)
444+ StmMap.reset sessions
445+#else
437− STMMap.deleteAll sessions
446+ StmMap.deleteAll sessions
447+#endif
438 pure ()
448 pure ()
439 closeLocalNode (ipLocalNode conf)
449 closeLocalNode (ipLocalNode conf)
440 closeTransport (ipTransport conf)
450 closeTransport (ipTransport conf)
@@ -494,7 +504,7 @@ remoteCall (RemoteProcessConnection conf) arg = runProcessResult localNode $ do
494
504
495sessionForSessionId :: SessionId -> Sessions -> STM (Either RelationalError Session)
505sessionForSessionId :: SessionId -> Sessions -> STM (Either RelationalError Session)
496sessionForSessionId sessionId sessions =
506sessionForSessionId sessionId sessions =
497− maybe (Left $ NoSuchSessionError sessionId) Right <$> STMMap.lookup sessionId sessions
507+ maybe (Left $ NoSuchSessionError sessionId) Right <$> StmMap.lookup sessionId sessions
498
508
499schemaForSessionId :: Session -> STM (Either RelationalError Schema)
509schemaForSessionId :: Session -> STM (Either RelationalError Schema)
500schemaForSessionId session = do
510schemaForSessionId session = do
@@ -536,7 +546,7 @@ setCurrentSchemaName sessionId (InProcessConnection conf) sname = atomically $ d
536 Left err -> pure (Left err)
546 Left err -> pure (Left err)
537 Right session -> case Sess.setSchemaName sname session of
547 Right session -> case Sess.setSchemaName sname session of
538 Left err -> pure (Left err)
548 Left err -> pure (Left err)
539− Right newSession -> STMMap.insert newSession sessionId sessions >> pure (Right ())
549+ Right newSession -> StmMap.insert newSession sessionId sessions >> pure (Right ())
540setCurrentSchemaName sessionId conn@(RemoteProcessConnection _) sname = remoteCall conn (ExecuteSetCurrentSchema sessionId sname)
550setCurrentSchemaName sessionId conn@(RemoteProcessConnection _) sname = remoteCall conn (ExecuteSetCurrentSchema sessionId sname)
541
551
542-- | Execute a relational expression in the context of the session and connection. Relational expressions are queries and therefore cannot alter the database.
552-- | Execute a relational expression in the context of the session and connection. Relational expressions are queries and therefore cannot alter the database.
@@ -589,7 +599,7 @@ executeDatabaseContextExpr sessionId (InProcessConnection conf) expr = excEither
589 newSubschemas = Schema.processDatabaseContextExprSchemasUpdate (Sess.subschemas session) expr
599 newSubschemas = Schema.processDatabaseContextExprSchemasUpdate (Sess.subschemas session) expr
590 newSchemas = Schemas context' newSubschemas
600 newSchemas = Schemas context' newSubschemas
591 newSession = Session newDiscon (Sess.schemaName session)
601 newSession = Session newDiscon (Sess.schemaName session)
592− STMMap.insert newSession sessionId sessions
602+ StmMap.insert newSession sessionId sessions
593 pure (Right ())
603 pure (Right ())
594executeDatabaseContextExpr sessionId conn@(RemoteProcessConnection _) dbExpr = remoteCall conn (ExecuteDatabaseContextExpr sessionId dbExpr)
604executeDatabaseContextExpr sessionId conn@(RemoteProcessConnection _) dbExpr = remoteCall conn (ExecuteDatabaseContextExpr sessionId dbExpr)
595
605
@@ -639,7 +649,7 @@ executeDatabaseContextIOExpr sessionId (InProcessConnection conf) expr = excEith
639 let newDiscon = DisconnectedTransaction (Sess.parentId session) newSchemas True
649 let newDiscon = DisconnectedTransaction (Sess.parentId session) newSchemas True
640 newSchemas = Schemas context' (Sess.subschemas session)
650 newSchemas = Schemas context' (Sess.subschemas session)
641 newSession = Session newDiscon (Sess.schemaName session)
651 newSession = Session newDiscon (Sess.schemaName session)
642− atomically $ STMMap.insert newSession sessionId sessions
652+ atomically $ StmMap.insert newSession sessionId sessions
643 pure (Right ())
653 pure (Right ())
644executeDatabaseContextIOExpr sessionId conn@(RemoteProcessConnection _) dbExpr = remoteCall conn (ExecuteDatabaseContextIOExpr sessionId dbExpr)
654executeDatabaseContextIOExpr sessionId conn@(RemoteProcessConnection _) dbExpr = remoteCall conn (ExecuteDatabaseContextIOExpr sessionId dbExpr)
645
655
@@ -750,7 +760,7 @@ executeGraphExpr sessionId (InProcessConnection conf) graphExpr = excEither $ do
750 Left err -> pure $ Left err
760 Left err -> pure $ Left err
751 Right previousTrans -> do
761 Right previousTrans -> do
752 (evaldNots, nodes) <- executeCommitExprSTM_ (Trans.concreteDatabaseContext previousTrans) (Sess.concreteDatabaseContext session) clientNodes
762 (evaldNots, nodes) <- executeCommitExprSTM_ (Trans.concreteDatabaseContext previousTrans) (Sess.concreteDatabaseContext session) clientNodes
753− nodesToNotify <- toList (STMSet.stream nodes)
763+ nodesToNotify <- toList (StmSet.stream nodes)
754 pure $ Right (evaldNots, nodesToNotify, newGraph)
764 pure $ Right (evaldNots, nodesToNotify, newGraph)
755 else
765 else
756 pure $ Right (M.empty, [], newGraph)
766 pure $ Right (M.empty, [], newGraph)
@@ -792,7 +802,7 @@ executeSchemaExpr sessionId (InProcessConnection conf) schemaExpr = atomically $
792 let discon = Sess.disconnectedTransaction session
802 let discon = Sess.disconnectedTransaction session
793 newSchemas = Schemas newContext newSubschemas
803 newSchemas = Schemas newContext newSubschemas
794 newSession = Session (DisconnectedTransaction (Discon.parentId discon) newSchemas True) (Sess.schemaName session)
804 newSession = Session (DisconnectedTransaction (Discon.parentId discon) newSchemas True) (Sess.schemaName session)
795− STMMap.insert newSession sessionId sessions
805+ StmMap.insert newSession sessionId sessions
796 pure (Right ())
806 pure (Right ())
797executeSchemaExpr sessionId conn@(RemoteProcessConnection _) schemaExpr = remoteCall conn (ExecuteSchemaExpr sessionId schemaExpr)
807executeSchemaExpr sessionId conn@(RemoteProcessConnection _) schemaExpr = remoteCall conn (ExecuteSchemaExpr sessionId schemaExpr)
798
808
@@ -1020,7 +1030,7 @@ transactionGraph_ _ = error "remote connection used"
1020disconnectedTransaction_ :: SessionId -> Connection -> IO DisconnectedTransaction
1030disconnectedTransaction_ :: SessionId -> Connection -> IO DisconnectedTransaction
1021disconnectedTransaction_ sessionId (InProcessConnection conf) = do
1031disconnectedTransaction_ sessionId (InProcessConnection conf) = do
1022 let sessions = ipSessions conf
1032 let sessions = ipSessions conf
1023− mSession <- atomically $ STMMap.lookup sessionId sessions
1033+ mSession <- atomically $ StmMap.lookup sessionId sessions
1024 case mSession of
1034 case mSession of
1025 Nothing -> error "No such session"
1035 Nothing -> error "No such session"
1026 Just (Sess.Session discon _) -> pure discon
1036 Just (Sess.Session discon _) -> pure discon
@@ -1078,13 +1088,13 @@ commitLock_ sessionId conf stmBlock = do
1078 Right (discon', graph', transactionIdsToPersist) -> do
1088 Right (discon', graph', transactionIdsToPersist) -> do
1079 writeTVar graphTvar graph'
1089 writeTVar graphTvar graph'
1080 let newSession = Session discon' (Sess.schemaName session)
1090 let newSession = Session discon' (Sess.schemaName session)
1081− STMMap.insert newSession sessionId sessions
1091+ StmMap.insert newSession sessionId sessions
1082 case transactionForId (Sess.parentId session) oldGraph of
1092 case transactionForId (Sess.parentId session) oldGraph of
1083 Left err -> pure $ Left err
1093 Left err -> pure $ Left err
1084 Right previousTrans ->
1094 Right previousTrans ->
1085 if not (Prelude.null transactionIdsToPersist) then do
1095 if not (Prelude.null transactionIdsToPersist) then do
1086 (evaldNots, nodes) <- executeCommitExprSTM_ (Trans.concreteDatabaseContext previousTrans) (Sess.concreteDatabaseContext session) clientNodes
1096 (evaldNots, nodes) <- executeCommitExprSTM_ (Trans.concreteDatabaseContext previousTrans) (Sess.concreteDatabaseContext session) clientNodes
1087− nodesToNotify <- toList (STMSet.stream nodes)
1097+ nodesToNotify <- stmSetToList nodes
1088 pure $ Right (evaldNots, nodesToNotify, graph', transactionIdsToPersist)
1098 pure $ Right (evaldNots, nodesToNotify, graph', transactionIdsToPersist)
1089 else pure (Right (M.empty, [], graph', []))
1099 else pure (Right (M.empty, [], graph', []))
1090
1100
@@ -1101,7 +1111,7 @@ writeDisconAndGraph_ :: TVar TransactionGraph -> SessionId -> Session -> Session
1101writeDisconAndGraph_ graphTvar sessionId session sessions discon graph = do
1111writeDisconAndGraph_ graphTvar sessionId session sessions discon graph = do
1102 writeTVar graphTvar graph
1112 writeTVar graphTvar graph
1103 let newSession = Session discon (Sess.schemaName session)
1113 let newSession = Session discon (Sess.schemaName session)
1104− STMMap.insert newSession sessionId sessions
1114+ StmMap.insert newSession sessionId sessions
1105-}
1115-}
1106
1116
1107-- | Runs an IO monad, commits the result when the monad returns no errors, otherwise, rolls back the changes and the error.
1117-- | Runs an IO monad, commits the result when the monad returns no errors, otherwise, rolls back the changes and the error.
src/lib/ProjectM36/IsomorphicSchema.hs+4−6
@@ -14,9 +14,7 @@ import Data.Binary
14import qualified Data.Map as M
14import qualified Data.Map as M
15import qualified Data.Set as S
15import qualified Data.Set as S
16import qualified Data.List as L
16import qualified Data.List as L
17−import qualified Data.Text as T
18import Data.Monoid
17import Data.Monoid
19−--import Debug.Trace
20-- isomorphic schemas offer bi-directional functors between two schemas
18-- isomorphic schemas offer bi-directional functors between two schemas
21
19
22--TODO: note that renaming a relvar should alter any stored isomorphisms as well
20--TODO: note that renaming a relvar should alter any stored isomorphisms as well
@@ -304,11 +302,11 @@ validate morph underlyingRvNames = if S.size invalidRvNames > 0 then
304
302
305-- | Create inclusion dependencies mainly for IsoRestrict because the predicate should hold in the base schema.
303-- | Create inclusion dependencies mainly for IsoRestrict because the predicate should hold in the base schema.
306createIncDepsForIsomorph :: SchemaName -> SchemaIsomorph -> InclusionDependencies
304createIncDepsForIsomorph :: SchemaName -> SchemaIsomorph -> InclusionDependencies
307−createIncDepsForIsomorph sname (IsoRestrict _ predi (rvTrue, rvFalse)) = let
305+createIncDepsForIsomorph sname (IsoRestrict origRv predi (rvTrue, rvFalse)) = let
308 newIncDep predicate rv = InclusionDependency (Project AN.empty (Restrict predicate (RelationVariable rv ()))) (ExistingRelation relationTrue)
306 newIncDep predicate rv = InclusionDependency (Project AN.empty (Restrict predicate (RelationVariable rv ()))) (ExistingRelation relationTrue)
309− incDepName b = "schema" <> "_" <> sname <> "_" <> T.pack (show b) in
307+ incDepName b = "schema" <> "_" <> sname <> "_" <> b in
310− M.fromList [(incDepName True, newIncDep predi rvTrue),
308+ M.fromList [(incDepName (origRv <> "_true"), newIncDep predi rvTrue),
311− (incDepName False, newIncDep (NotPredicate predi) rvFalse)]
309+ (incDepName (origRv <> "_false"), newIncDep (NotPredicate predi) rvFalse)]
312createIncDepsForIsomorph _ _ = M.empty
310createIncDepsForIsomorph _ _ = M.empty
313
311
314-- in the case of IsoRestrict, the database context should be updated with the restriction so that if the restriction does not hold, then the schema cannot be created
312-- in the case of IsoRestrict, the database context should be updated with the restriction so that if the restriction does not hold, then the schema cannot be created
src/lib/ProjectM36/Persist.hs+8−5
@@ -66,7 +66,13 @@ renameSync sync srcPath dstPath = do
66atomicRename :: FilePath -> FilePath -> IO ()
66atomicRename :: FilePath -> FilePath -> IO ()
67atomicRename srcPath dstPath =
67atomicRename srcPath dstPath =
68#if defined(mingw32_HOST_OS)
68#if defined(mingw32_HOST_OS)
69+#if MIN_VERSION_Win32(2,6,0)
70+ let dst = Just dstPath
71+#else
72+ let dst = dstPath
73+#endif
74+ in
69− Win32.moveFileEx srcPath dstPath Win32.mOVEFILE_REPLACE_EXISTING
75+ Win32.moveFileEx srcPath dst Win32.mOVEFILE_REPLACE_EXISTING
70#else
76#else
71 Posix.rename srcPath dstPath
77 Posix.rename srcPath dstPath
72#endif
78#endif
@@ -119,13 +125,10 @@ printFdCount =
119 putStrLn "Fd count not supported on this OS."
125 putStrLn "Fd count not supported on this OS."
120#endif
126#endif
121
127
122−
123−fdCount :: IO Int
124#if FDCOUNTSUPPORTED
128#if FDCOUNTSUPPORTED
129+fdCount :: IO Int
125fdCount = do
130fdCount = do
126 fds <- getDirectoryContents FDDIR
131 fds <- getDirectoryContents FDDIR
127 pure ((length fds) - 2)
132 pure ((length fds) - 2)
128−#else
129--not supported on non-linux
133--not supported on non-linux
130−fdCount = pure 0
131#endif
134#endif
src/lib/ProjectM36/Relation.hs+4
@@ -64,6 +64,10 @@ mkRelationDeferVerify :: Attributes -> RelationTupleSet -> Either RelationalErro
64mkRelationDeferVerify attrs tupleSet = return $ Relation attrs (RelationTupleSet (filter tupleFilter (asList tupleSet)))
64mkRelationDeferVerify attrs tupleSet = return $ Relation attrs (RelationTupleSet (filter tupleFilter (asList tupleSet)))
65 where
65 where
66 tupleFilter tuple = isRight (verifyTuple attrs tuple)
66 tupleFilter tuple = isRight (verifyTuple attrs tuple)
67+
68+--return a relation of the same type except without any tuples
69+relationWithEmptyTupleSet :: Relation -> Relation
70+relationWithEmptyTupleSet (Relation attrs _) = emptyRelationWithAttrs attrs
67
71
68mkRelationFromTuples :: Attributes -> [RelationTuple] -> Either RelationalError Relation
72mkRelationFromTuples :: Attributes -> [RelationTuple] -> Either RelationalError Relation
69mkRelationFromTuples attrs tupleSetList = do
73mkRelationFromTuples attrs tupleSetList = do
src/lib/ProjectM36/RelationalExpression.hs+14−9
@@ -663,7 +663,10 @@ typeForRelationalExpr expr = do
663 --replace the relationVariables context element with a cloned set of relation devoid of tuples
663 --replace the relationVariables context element with a cloned set of relation devoid of tuples
664 let context' = contextWithEmptyTupleSets context
664 let context' = contextWithEmptyTupleSets context
665 rstate' = setStateElemsContext rstate context'
665 rstate' = setStateElemsContext rstate context'
666+ --evalRelationalExpr could still return an existing relation with tuples, so strip them
666− pure (runReader (evalRelationalExpr expr) rstate')
667+ pure $ case runReader (evalRelationalExpr expr) rstate' of
668+ Left err -> Left err
669+ Right typeRel -> Right (relationWithEmptyTupleSet typeRel)
667
670
668--returns a database context with all tuples removed
671--returns a database context with all tuples removed
669--this is useful for type checking and optimization
672--this is useful for type checking and optimization
@@ -750,18 +753,18 @@ predicateRestrictionFilter attrs (AtomExprPredicate atomExpr) = do
750 --merge attrs into the state attributes
753 --merge attrs into the state attributes
751 rstate <- ask
754 rstate <- ask
752 runExceptT $ do
755 runExceptT $ do
753− aType <- liftE (typeFromAtomExpr attrs atomExpr)
756+ aType <- liftE (typeFromAtomExpr attrs atomExpr)
754 if aType /= BoolAtomType then
757 if aType /= BoolAtomType then
755 throwE (AtomTypeMismatchError aType BoolAtomType)
758 throwE (AtomTypeMismatchError aType BoolAtomType)
756 else
759 else
757 pure (\tupleIn ->
760 pure (\tupleIn ->
758− pure $ case runReader (evalAtomExpr tupleIn atomExpr) rstate of
761+ case runReader (evalAtomExpr tupleIn atomExpr) rstate of
759− Left _ -> False
762+ Left err -> Left err
760− Right boolAtomValue -> boolAtomValue == BoolAtom True)
763+ Right boolAtomValue -> pure (boolAtomValue == BoolAtom True))
761
764
762tupleExprCheckNewAttrName :: AttributeName -> Relation -> Either RelationalError Relation
765tupleExprCheckNewAttrName :: AttributeName -> Relation -> Either RelationalError Relation
763tupleExprCheckNewAttrName attrName rel = if isRight (attributeForName attrName rel) then
766tupleExprCheckNewAttrName attrName rel = if isRight (attributeForName attrName rel) then
764− Left (error "SPAMMIT" $ AttributeNameInUseError attrName)
767+ Left (AttributeNameInUseError attrName)
765 else
768 else
766 Right rel
769 Right rel
767
770
@@ -800,13 +803,15 @@ evalAtomExpr tupIn (FunctionAtomExpr funcName arguments ()) = do
800 func <- either throwE pure (atomFunctionForName funcName functions)
803 func <- either throwE pure (atomFunctionForName funcName functions)
801 let expectedArgCount = length (atomFuncType func) - 1
804 let expectedArgCount = length (atomFuncType func) - 1
802 actualArgCount = length argTypes
805 actualArgCount = length argTypes
803− safeInit [_] = []
804 safeInit [] = [] -- different behavior from normal init
806 safeInit [] = [] -- different behavior from normal init
805− safeInit (_:xs) = safeInit xs
807+ safeInit xs = init xs
806 if expectedArgCount /= actualArgCount then
808 if expectedArgCount /= actualArgCount then
807 throwE (FunctionArgumentCountMismatchError expectedArgCount actualArgCount)
809 throwE (FunctionArgumentCountMismatchError expectedArgCount actualArgCount)
808 else do
810 else do
811+ let zippedArgs = zip (safeInit (atomFuncType func)) argTypes
812+ mapM_ (\(expType, eActType) -> do
813+ actType <- either throwE pure eActType
809− mapM_ (\(expType, actType) -> either throwE pure (atomTypeVerify expType actType)) (safeInit (zip (atomFuncType func) argTypes))
814+ either throwE pure (atomTypeVerify expType actType)) zippedArgs
810 evaldArgs <- mapM (liftE . evalAtomExpr tupIn) arguments
815 evaldArgs <- mapM (liftE . evalAtomExpr tupIn) arguments
811 case evalAtomFunction func evaldArgs of
816 case evalAtomFunction func evaldArgs of
812 Left err -> throwE (AtomFunctionUserError err)
817 Left err -> throwE (AtomFunctionUserError err)
src/lib/ProjectM36/ScriptSession.hs+31−1
@@ -22,12 +22,20 @@ import GHCi.ObjLink
22#else
22#else
23import ObjLink
23import ObjLink
24#endif
24#endif
25+#if __GLASGOW_HASKELL__ >= 802
26+import BasicTypes
27+#endif
25import DynFlags
28import DynFlags
26import Panic
29import Panic
27import Outputable --hiding ((<>))
30import Outputable --hiding ((<>))
28import PprTyThing
31import PprTyThing
29import Unsafe.Coerce
32import Unsafe.Coerce
33+#if __GLASGOW_HASKELL__ >= 802
30import Type
34import Type
35+#elif __GLASGOW_HASKELL__ >= 710
36+import Type hiding (pprTyThing)
37+#else
38+#endif
31
39
32import GHC.Exts (addrToAny#)
40import GHC.Exts (addrToAny#)
33import GHC.Ptr (Ptr(..))
41import GHC.Ptr (Ptr(..))
@@ -75,7 +83,12 @@ initScriptSession ghcPkgPaths = do
75 trustFlags = map TrustPackage required_packages,
83 trustFlags = map TrustPackage required_packages,
76#endif
84#endif
77 packageFlags = packageFlags dflags ++ packages,
85 packageFlags = packageFlags dflags ++ packages,
86+#if __GLASGOW_HASKELL__ >= 802
87+ packageDBFlags = map PackageDB localPkgPaths
88+#else
78 extraPkgConfs = const (localPkgPaths ++ [UserPkgConf, GlobalPkgConf])
89 extraPkgConfs = const (localPkgPaths ++ [UserPkgConf, GlobalPkgConf])
90+#endif
91+
79 }
92 }
80 applyGopts flags = foldl gopt_set flags gopts
93 applyGopts flags = foldl gopt_set flags gopts
81 applyXopts flags = foldl xopt_set flags xopts
94 applyXopts flags = foldl xopt_set flags xopts
@@ -107,7 +120,11 @@ initScriptSession ghcPkgPaths = do
107 --liftIO $ traceShowM (showSDoc dflags' (ppr packages))
120 --liftIO $ traceShowM (showSDoc dflags' (ppr packages))
108 _ <- setSessionDynFlags dflags'
121 _ <- setSessionDynFlags dflags'
109 let safeImportDecl mn mQual = ImportDecl {
122 let safeImportDecl mn mQual = ImportDecl {
123+#if __GLASGOW_HASKELL__ >= 802
124+ ideclSourceSrc = NoSourceText,
125+#else
110 ideclSourceSrc = Nothing,
126 ideclSourceSrc = Nothing,
127+#endif
111 ideclName = noLoc mn,
128 ideclName = noLoc mn,
112 ideclPkgQual = Nothing,
129 ideclPkgQual = Nothing,
113 ideclSource = False,
130 ideclSource = False,
@@ -129,7 +146,12 @@ initScriptSession ghcPkgPaths = do
129 "ProjectM36.DatabaseContextFunctionError",
146 "ProjectM36.DatabaseContextFunctionError",
130 "ProjectM36.DatabaseContextFunctionUtils",
147 "ProjectM36.DatabaseContextFunctionUtils",
131 "ProjectM36.RelationalExpression"]
148 "ProjectM36.RelationalExpression"]
149+#if __GLASGOW_HASKELL__ >= 802
150+ mkModName = noLoc . mkModuleName
151+#else
152+ mkModName = mkModuleName
153+#endif
132− qualifiedModules = map (\(modn, qualNam) -> IIDecl $ safeImportDecl (mkModuleName modn) (Just (mkModuleName qualNam))) [
154+ qualifiedModules = map (\(modn, qualNam) -> IIDecl $ safeImportDecl (mkModuleName modn) (Just (mkModName qualNam))) [
133 ("Data.Text", "T")
155 ("Data.Text", "T")
134 ]
156 ]
135 setContext (unqualifiedModules ++ qualifiedModules)
157 setContext (unqualifiedModules ++ qualifiedModules)
@@ -177,7 +199,11 @@ typeCheckScript :: Type -> Text -> Ghc (Maybe ScriptCompilationError)
177typeCheckScript expectedType inp = do
199typeCheckScript expectedType inp = do
178 dflags <- getSessionDynFlags
200 dflags <- getSessionDynFlags
179 --catch exception for SyntaxError
201 --catch exception for SyntaxError
202+#if __GLASGOW_HASKELL__ >= 802
203+ funcType <- GHC.exprType TM_Inst (unpack inp)
204+#else
180 funcType <- GHC.exprType (unpack inp)
205 funcType <- GHC.exprType (unpack inp)
206+#endif
181 --liftIO $ putStrLn $ showType dflags expectedType ++ ":::" ++ showType dflags funcType
207 --liftIO $ putStrLn $ showType dflags expectedType ++ ":::" ++ showType dflags funcType
182 if eqType funcType expectedType then
208 if eqType funcType expectedType then
183 pure Nothing
209 pure Nothing
@@ -197,7 +223,11 @@ data LoadSymbolError = LoadSymbolError
197
223
198loadFunction :: ModName -> FuncName -> FilePath -> IO (Either LoadSymbolError a)
224loadFunction :: ModName -> FuncName -> FilePath -> IO (Either LoadSymbolError a)
199loadFunction modName funcName objPath = do
225loadFunction modName funcName objPath = do
226+#if __GLASGOW_HASKELL__ >= 802
227+ initObjLinker RetainCAFs
228+#else
200 initObjLinker
229 initObjLinker
230+#endif
201 loadObj objPath
231 loadObj objPath
202 _ <- resolveObjs
232 _ <- resolveObjs
203 ptr <- lookupSymbol (mangleSymbol Nothing modName funcName)
233 ptr <- lookupSymbol (mangleSymbol Nothing modName funcName)
src/lib/ProjectM36/Server.hs−1
@@ -136,4 +136,3 @@ launchServer daemonConfig mAddressMVar = do
136 serve (conn, databaseName daemonConfig, mAddressMVar, address endpoint) initServer (serverDefinition testBool reqTimeout)
136 serve (conn, databaseName daemonConfig, mAddressMVar, address endpoint) initServer (serverDefinition testBool reqTimeout)
137 liftIO $ putStrLn "serve returned"
137 liftIO $ putStrLn "serve returned"
138 pure True
138 pure True
139−
src/lib/ProjectM36/Sessions.hs+28−5
@@ -1,18 +1,41 @@
1+{-# LANGUAGE PackageImports #-}
1module ProjectM36.Sessions where
2module ProjectM36.Sessions where
2import Control.Concurrent.STM
3import Control.Concurrent.STM
4+#if MIN_VERSION_stm_containers(1,0,0)
5+import qualified StmContainers.Map as StmMap
6+import qualified StmContainers.Set as StmSet
7+#else
3−import qualified STMContainers.Map as STMMap
8+import qualified STMContainers.Map as StmMap
4−import ListT
9+import qualified STMContainers.Set as StmSet
10+#endif
11+import "list-t" ListT
5import ProjectM36.Attribute
12import ProjectM36.Attribute
6import ProjectM36.Base
13import ProjectM36.Base
7import ProjectM36.Session
14import ProjectM36.Session
8import ProjectM36.Relation
15import ProjectM36.Relation
9import ProjectM36.Error
16import ProjectM36.Error
10import qualified Data.UUID as U
17import qualified Data.UUID as U
18+import qualified Control.Foldl as Foldl
19+#if MIN_VERSION_stm_containers(1,0,0)
20+import qualified DeferredFolds.UnfoldlM as UF
21+#endif
11
22
12−type Sessions = STMMap.Map SessionId Session
23+type Sessions = StmMap.Map SessionId Session
13
24
25+--from https://github.com/nikita-volkov/stm-containers/blob/master/test/Main/MapTests.hs
14−stmMapToList :: STMMap.Map k v -> STM [(k, v)]
26+stmMapToList :: StmMap.Map k v -> STM [(k, v)]
27+#if MIN_VERSION_stm_containers(1,0,0)
28+stmMapToList = UF.foldM (Foldl.generalize Foldl.list) . StmMap.unfoldlM
29+#else
30+stmMapToList = ListT.fold (\l -> return . (:l)) [] . StmMap.stream
31+#endif
32+
33+stmSetToList :: StmSet.Set v -> STM [v]
34+#if MIN_VERSION_stm_containers(1,0,0)
35+stmSetToList = UF.foldM (Foldl.generalize Foldl.list) . StmSet.unfoldlM
36+#else
15−stmMapToList = ListT.fold (\l -> return . (:l)) [] . STMMap.stream
37+stmSetToList = ListT.fold (\l -> return . (:l)) [] . StmSet.stream
38+#endif
16
39
17uuidAtom :: U.UUID -> Atom
40uuidAtom :: U.UUID -> Atom
18uuidAtom = TextAtom . U.toText
41uuidAtom = TextAtom . U.toText
src/lib/ProjectM36/Win32Handle.hs+4−1
@@ -53,5 +53,8 @@ withHandleToHANDLE haskell_handle action =
53 -- Do what the user originally wanted
53 -- Do what the user originally wanted
54 action windows_handle
54 action windows_handle
55
55
56+#if MIN_VERSION_Win32(2,5,1)
57+#else
56withStablePtr :: a -> (StablePtr a -> IO b) -> IO b
58withStablePtr :: a -> (StablePtr a -> IO b) -> IO b
57−withStablePtr value = bracket (newStablePtr value) freeStablePtr
59+withStablePtr value = bracket (newStablePtr value) freeStablePtr
60+#endif
stack.yaml → stack.ghc8.0.yamlrenamed+1−1
@@ -19,8 +19,8 @@ extra-deps:
19- distributed-process-async-0.2.4
19- distributed-process-async-0.2.4
20- distributed-process-client-server-0.2.3
20- distributed-process-client-server-0.2.3
21- distributed-process-extras-0.3.2
21- distributed-process-extras-0.3.2
22+- deferred-folds-0.6.12
22- rset-1.0.0
23- rset-1.0.0
23−- binary-0.8.5.1
24
24
25# Override default flag values for local packages and extra-deps
25# Override default flag values for local packages and extra-deps
26flags: {}
26flags: {}
stack.ghc7.10.yaml → stack.ghc8.2.yamlrenamed+6−6
@@ -2,7 +2,7 @@
2# For more information, see: http://docs.haskellstack.org/en/stable/yaml_configuration/
2# For more information, see: http://docs.haskellstack.org/en/stable/yaml_configuration/
3
3
4# Specifies the GHC version and set of packages available (e.g., lts-3.5, nightly-2015-09-21, ghc-7.10.2)
4# Specifies the GHC version and set of packages available (e.g., lts-3.5, nightly-2015-09-21, ghc-7.10.2)
5−resolver: lts-6.35
5+resolver: lts-11.20
6
6
7# Local packages, usually specified by relative directory name
7# Local packages, usually specified by relative directory name
8packages:
8packages:
@@ -15,16 +15,16 @@ extra-deps:
15- gnuplot-0.5.4.1
15- gnuplot-0.5.4.1
16- text-1.2.2.1
16- text-1.2.2.1
17- aeson-1.2.1.00
17- aeson-1.2.1.00
18−- distributed-process-0.6.6
18+- distributed-process-0.7.3
19−- distributed-process-async-0.2.4
19+- distributed-process-async-0.2.4.1
20- distributed-process-client-server-0.2.3
20- distributed-process-client-server-0.2.3
21- distributed-process-extras-0.3.2
21- distributed-process-extras-0.3.2
22−- cryptohash-sha256-0.11.100.1
23−- megaparsec-5.3.1
24- rset-1.0.0
22- rset-1.0.0
25
23
26# Override default flag values for local packages and extra-deps
24# Override default flag values for local packages and extra-deps
27−flags: {}
25+flags:
26+ project-m36:
27+ stack: true
28
28
29# Extra package databases containing global packages
29# Extra package databases containing global packages
30extra-package-dbs: []
30extra-package-dbs: []
stack.ghc8.4.yamlnew file+53
@@ -0,0 +1,53 @@
1+# This file was automatically generated by stack init
2+# For more information, see: http://docs.haskellstack.org/en/stable/yaml_configuration/
3+
4+# Specifies the GHC version and set of packages available (e.g., lts-3.5, nightly-2015-09-21, ghc-7.10.2)
5+resolver: lts-12.11
6+
7+# Local packages, usually specified by relative directory name
8+packages:
9+- '.'
10+# Packages to be pulled from upstream that are not in the resolver (e.g., acme-missiles-0.3)
11+extra-deps:
12+- data-accessor-transformers-0.2.1.7
13+- data-interval-1.2.0
14+- extended-reals-0.2.1.0
15+- gnuplot-0.5.5.3
16+- aeson-1.2.1.00
17+- distributed-process-0.7.4
18+- distributed-process-async-0.2.4.1
19+- distributed-process-client-server-0.2.3
20+- distributed-process-extras-0.3.2
21+#- deferred-folds-0.9.7.1
22+- rset-1.0.0
23+- hashable-time-0.2.0.2
24+- network-transport-tcp-0.6.0
25+
26+# Override default flag values for local packages and extra-deps
27+flags:
28+ project-m36:
29+ stack: true
30+
31+# Extra package databases containing global packages
32+extra-package-dbs: []
33+
34+# Control whether we use the GHC we find on the path
35+# system-ghc: true
36+
37+# Require a specific version of stack, using version ranges
38+# require-stack-version: -any # Default
39+# require-stack-version: >= 1.0.0
40+
41+# Override the architecture used by stack, especially useful on Windows
42+# arch: i386
43+# arch: x86_64
44+
45+# Extra directories used by stack for building
46+# extra-include-dirs: [/path/to/dir]
47+# extra-lib-dirs: [/path/to/dir]
48+
49+# Allow a newer minor version of GHC than the snapshot specifies
50+# compiler-check: newer-minor
51+
52+allow-newer: true
53+
test/IsomorphicSchema.hs+6−6
@@ -105,15 +105,15 @@ testIsoUnion = TestCase $ do
105 --create motors relation which is split into low-power (<50 horsepower) and high-power (>=50 horsepower) motors
105 --create motors relation which is split into low-power (<50 horsepower) and high-power (>=50 horsepower) motors
106 --the schema is contains the split relvars
106 --the schema is contains the split relvars
107 motorsRel <- assertEither $ mkRelationFromList (A.attributesFromList [Attribute "name" TextAtomType,
107 motorsRel <- assertEither $ mkRelationFromList (A.attributesFromList [Attribute "name" TextAtomType,
108− Attribute "power" IntAtomType])
108+ Attribute "power" IntegerAtomType])
109− [[TextAtom "Puny", IntAtom 10],
109+ [[TextAtom "Puny", IntegerAtom 10],
110− [TextAtom "Scooter", IntAtom 49],
110+ [TextAtom "Scooter", IntegerAtom 49],
111− [TextAtom "Auto", IntAtom 200],
111+ [TextAtom "Auto", IntegerAtom 200],
112− [TextAtom "Tractor", IntAtom 500]]
112+ [TextAtom "Tractor", IntegerAtom 500]]
113 let baseSchema = mkRelationalExprState DBC.basicDatabaseContext {
113 let baseSchema = mkRelationalExprState DBC.basicDatabaseContext {
114 relationVariables = M.singleton "motor" motorsRel
114 relationVariables = M.singleton "motor" motorsRel
115 }
115 }
116− splitPredicate = AtomExprPredicate (FunctionAtomExpr "lt" [AttributeAtomExpr "power", NakedAtomExpr (IntAtom 50)] ())
116+ splitPredicate = AtomExprPredicate (FunctionAtomExpr "lt" [AttributeAtomExpr "power", NakedAtomExpr (IntegerAtom 50)] ())
117 splitIsomorphs = [IsoUnion ("lowpower", "highpower") splitPredicate "motor",
117 splitIsomorphs = [IsoUnion ("lowpower", "highpower") splitPredicate "motor",
118 IsoRename "true" "true",
118 IsoRename "true" "true",
119 IsoRename "false" "false"]
119 IsoRename "false" "false"]
test/Relation/Atomable.hs+9−1
@@ -44,6 +44,9 @@ data Test6T = Test6C (Maybe Integer)
44
44
45data Test7T = Test7C (Either Integer Integer)
45data Test7T = Test7C (Either Integer Integer)
46 deriving (Show, Generic, Eq, Binary, NFData, Atomable)
46 deriving (Show, Generic, Eq, Binary, NFData, Atomable)
47+
48+data Test8T = Test8C Test1T
49+ deriving (Show, Generic, Eq, Binary, NFData, Atomable)
47
50
48main :: IO ()
51main :: IO ()
49main = do
52main = do
@@ -51,7 +54,7 @@ main = do
51 if errors tcounts + failures tcounts > 0 then exitFailure else exitSuccess
54 if errors tcounts + failures tcounts > 0 then exitFailure else exitSuccess
52
55
53testList :: Test
56testList :: Test
54−testList = TestList [testHaskell2DB, testADT1, testADT2, testADT3, testADT4, testADT5, testBasicMarshaling, testListInstance, testNonEmptyInstance, testADT6Maybe, testADT7Either]
57+testList = TestList [testHaskell2DB, testADT1, testADT2, testADT3, testADT4, testADT5, testBasicMarshaling, testListInstance, testNonEmptyInstance, testADT6Maybe, testADT7Either, testNonPrimitiveValues]
55
58
56
59
57-- test some basic data types like int, day, etc.
60-- test some basic data types like int, day, etc.
@@ -141,3 +144,8 @@ testNonEmptyInstance :: Test
141testNonEmptyInstance = TestCase $ do
144testNonEmptyInstance = TestCase $ do
142 let example = TestNonEmptyC [3,4,5]
145 let example = TestNonEmptyC [3,4,5]
143 assertEqual "NonEmpty instance" example (fromAtom (toAtom example))
146 assertEqual "NonEmpty instance" example (fromAtom (toAtom example))
147+
148+testNonPrimitiveValues :: Test
149+testNonPrimitiveValues = TestCase $ do
150+ let example = Test8C (Test1C 3)
151+ assertEqual "non-primitive values" example (fromAtom (toAtom example))
test/Relation/Basic.hs+8−2
@@ -25,7 +25,8 @@ testList = TestList [testRelation "relationTrue" relationTrue, testRelation "rel
25 testRelation "products" productsRel,
25 testRelation "products" productsRel,
26 testRelation "supplierProducts" supplierProductsRel,
26 testRelation "supplierProducts" supplierProductsRel,
27 testMkRelationFromExprsBadAttrs,
27 testMkRelationFromExprsBadAttrs,
28− testDuplicateAttributes
28+ testDuplicateAttributes,
29+ testExistingRelationType
29 ]
30 ]
30
31
31main :: IO ()
32main :: IO ()
@@ -103,4 +104,9 @@ testDuplicateAttributes :: Test
103testDuplicateAttributes = TestCase $ do
104testDuplicateAttributes = TestCase $ do
104 let eRel = mkRelation attrs emptyTupleSet
105 let eRel = mkRelation attrs emptyTupleSet
105 attrs = attributesFromList [Attribute "a" IntAtomType, Attribute "a" TextAtomType]
106 attrs = attributesFromList [Attribute "a" IntAtomType, Attribute "a" TextAtomType]
106− assertEqual "duplicate attribute names" (Left (DuplicateAttributeNamesError (S.singleton "a"))) eRel
107+ assertEqual "duplicate attribute names" (Left (DuplicateAttributeNamesError (S.singleton "a"))) eRel
108+
109+testExistingRelationType :: Test
110+testExistingRelationType = TestCase $ do
111+ let typeResult = runReader (typeForRelationalExpr (ExistingRelation relationTrue)) (RelationalExprStateElems DBC.empty)
112+ assertEqual "ExistingRelation with tuples type" (Right relationFalse) typeResult
test/Server/Main.hs+4−2
@@ -17,11 +17,13 @@ import System.Exit
17
17
18import Control.Concurrent
18import Control.Concurrent
19import Network.Transport (EndPointAddress)
19import Network.Transport (EndPointAddress)
20+
20#if MIN_VERSION_network_transport_tcp(0,6,0)
21#if MIN_VERSION_network_transport_tcp(0,6,0)
21import Network.Transport.TCP.Internal (encodeEndPointAddress, decodeEndPointAddress)
22import Network.Transport.TCP.Internal (encodeEndPointAddress, decodeEndPointAddress)
22#else
23#else
23import Network.Transport.TCP (encodeEndPointAddress, decodeEndPointAddress)
24import Network.Transport.TCP (encodeEndPointAddress, decodeEndPointAddress)
24#endif
25#endif
26+
25import Data.Either (isRight)
27import Data.Either (isRight)
26import Control.Exception
28import Control.Exception
27import System.IO.Temp
29import System.IO.Temp
@@ -220,12 +222,12 @@ testFileDescriptorCount :: Test
220#if defined(linux_HOST_OS)
222#if defined(linux_HOST_OS)
221--validate that creating a server, connecting a client, and then disconnecting doesn't leak file descriptors
223--validate that creating a server, connecting a client, and then disconnecting doesn't leak file descriptors
222testFileDescriptorCount = TestCase $ do
224testFileDescriptorCount = TestCase $ do
223− (serverAddress, serverTid) <- launchTestServer 1000
225+ (serverAddress, serverTid) <- launchTestServer 0
224 unusedMVar <- newEmptyMVar
226 unusedMVar <- newEmptyMVar
225 startCount <- fdCount
227 startCount <- fdCount
226 Right (sess, testConn) <- testConnection serverAddress unusedMVar
228 Right (sess, testConn) <- testConnection serverAddress unusedMVar
227 --add a test commit to trigger the fsync machinery
229 --add a test commit to trigger the fsync machinery
228− executeDatabaseContextExpr sess testConn (Assign "x" (ExistingRelation relationFalse)) >>= eitherFail
230+ executeDatabaseContextExpr sess testConn (Assign "x" (ExistingRelation relationFalse)) >>= eitherFail
229 commit sess testConn >>= eitherFail
231 commit sess testConn >>= eitherFail
230 close testConn
232 close testConn
231 endCount <- fdCount
233 endCount <- fdCount
test/Server/WebSocket.hs+1
@@ -24,6 +24,7 @@ import Network.Transport.TCP.Internal (decodeEndPointAddress)
24import Network.Transport.TCP (decodeEndPointAddress)
24import Network.Transport.TCP (decodeEndPointAddress)
25#endif
25#endif
26
26
27+
27--start the websocket server
28--start the websocket server
28-- run some tutoriald against it
29-- run some tutoriald against it
29
30
test/TransactionGraph/Persist.hs+5−4
@@ -25,8 +25,9 @@ main = do
25
25
26testList :: Test
26testList :: Test
27testList = TestList [testBootstrapDB,
27testList = TestList [testBootstrapDB,
28− testDBSimplePersistence,
28+ testDBSimplePersistence,
29 testFunctionPersistence]
29 testFunctionPersistence]
30+
30
31
31stamp :: UTCTime
32stamp :: UTCTime
32stamp = UTCTime (fromGregorian 1980 01 01) (secondsToDiffTime 1000)
33stamp = UTCTime (fromGregorian 1980 01 01) (secondsToDiffTime 1000)
@@ -74,7 +75,8 @@ testDBSimplePersistence = TestCase $ withSystemTempDirectory "m36testdb" $ \temp
74
75
75--only Haskell-scripted dbc and atom functions can be serialized
76--only Haskell-scripted dbc and atom functions can be serialized
76testFunctionPersistence :: Test
77testFunctionPersistence :: Test
78+testFunctionPersistence = TestCase $
77−testFunctionPersistence = TestCase $ withSystemTempDirectory "m36testdb" $ \tempdir -> do
79+ withSystemTempDirectory "m36testdb" $ \tempdir -> do
78 let dbdir = tempdir </> "dbdir"
80 let dbdir = tempdir </> "dbdir"
79 connInfo = InProcessConnectionInfo (MinimalPersistence dbdir) emptyNotificationCallback []
81 connInfo = InProcessConnectionInfo (MinimalPersistence dbdir) emptyNotificationCallback []
80 conn <- assertIOEither $ connectProjectM36 connInfo
82 conn <- assertIOEither $ connectProjectM36 connInfo
@@ -85,9 +87,8 @@ testFunctionPersistence = TestCase $ withSystemTempDirectory "m36testdb" $ \temp
85 ADTypeConstructor "Either" [ADTypeConstructor "AtomFunctionError" [],
87 ADTypeConstructor "Either" [ADTypeConstructor "AtomFunctionError" [],
86 intTCons]] "(\\(x:_) -> pure x) :: [Atom] -> Either AtomFunctionError Atom"
88 intTCons]] "(\\(x:_) -> pure x) :: [Atom] -> Either AtomFunctionError Atom"
87 _ <- assertIOEither $ executeDatabaseContextIOExpr sess conn addfunc
89 _ <- assertIOEither $ executeDatabaseContextIOExpr sess conn addfunc
88−
89 _ <- assertIOEither $ commit sess conn
90 _ <- assertIOEither $ commit sess conn
90− close conn
91+ --close conn - pauses indefinitely on Windows
91 --re-open the connection to reload the graph
92 --re-open the connection to reload the graph
92 conn2 <- assertIOEither $ connectProjectM36 connInfo
93 conn2 <- assertIOEither $ connectProjectM36 connInfo
93 sess2 <- assertIOEither $ createSessionAtHead conn2 "master"
94 sess2 <- assertIOEither $ createSessionAtHead conn2 "master"
test/TutorialD/Interpreter.hs+11−2
@@ -72,7 +72,8 @@ main = do
72 testArbitraryRelation,
72 testArbitraryRelation,
73 testNonEmptyListType,
73 testNonEmptyListType,
74 testUnresolvedAtomTypes,
74 testUnresolvedAtomTypes,
75− testWithClause
75+ testWithClause,
76+ testAtomFunctionArgumentMismatch
76 ]
77 ]
77 simpleRelTests = [("x:=true", Right relationTrue),
78 simpleRelTests = [("x:=true", Right relationTrue),
78 ("x:=false", Right relationFalse),
79 ("x:=false", Right relationFalse),
@@ -631,4 +632,12 @@ testWithClause = TestCase $ do
631
632
632 expectTutorialDErr sessionId dbconn (T.isPrefixOf err1) "x:=with (s as sp) s"
633 expectTutorialDErr sessionId dbconn (T.isPrefixOf err1) "x:=with (s as sp) s"
633
634
634−
635+testAtomFunctionArgumentMismatch :: Test
636+testAtomFunctionArgumentMismatch = TestCase $ do
637+ (sessionId, dbconn) <- dateExamplesConnection emptyNotificationCallback
638+ let err1 = "AtomTypeMismatchError"
639+ --atom function type mismatch
640+ expectTutorialDErr sessionId dbconn (T.isPrefixOf err1) "x:=relation{tuple{a 5}} where ^gt(@a,1.5)"
641+ --wrong argument count
642+ let err2 = "FunctionArgumentCountMismatchError"
643+ expectTutorialDErr sessionId dbconn (T.isPrefixOf err2) "x:=relation{tuple{a 5}} where ^gt(@a,1,3)"
test/TutorialD/Interpreter/DatabaseContextFunctionScript.hs−2
@@ -19,9 +19,7 @@ testBasicDBCFunction = TestCase $ do
19 (sess, conn) <- dateExamplesConnection emptyNotificationCallback
19 (sess, conn) <- dateExamplesConnection emptyNotificationCallback
20 let addfunc = "adddatabasecontextfunction \"addTrue2\" DatabaseContext -> Either DatabaseContextFunctionError DatabaseContext \"\"\"(\\[] ctx -> executeDatabaseContextExpr (Assign \"true2\" (ExistingRelation relationTrue)) ctx) :: [Atom] -> DatabaseContext -> Either DatabaseContextFunctionError DatabaseContext\"\"\""
20 let addfunc = "adddatabasecontextfunction \"addTrue2\" DatabaseContext -> Either DatabaseContextFunctionError DatabaseContext \"\"\"(\\[] ctx -> executeDatabaseContextExpr (Assign \"true2\" (ExistingRelation relationTrue)) ctx) :: [Atom] -> DatabaseContext -> Either DatabaseContextFunctionError DatabaseContext\"\"\""
21 executeTutorialD sess conn addfunc
21 executeTutorialD sess conn addfunc
22− putStrLn "spam1"
23 executeTutorialD sess conn "execute addTrue2()"
22 executeTutorialD sess conn "execute addTrue2()"
24− putStrLn "spam2"
25 {-
23 {-
26 let true2Expr = RelationVariable "true2" ()
24 let true2Expr = RelationVariable "true2" ()
27 result <- executeRelationalExpr sess conn true2Expr
25 result <- executeRelationalExpr sess conn true2Expr