on master help sign in
Merge branch '25_ghc_8'
2097579AgentM
project-m36.cabal+26−40
@@ -12,7 +12,7 @@ Synopsis: Relational Algebra Engine
12Description: A relational algebra engine which can be used to persist and query Haskell data types.
12Description: A relational algebra engine which can be used to persist and query Haskell data types.
13
13
14Library
14Library
15− Build-Depends: base>=4.8 && < 4.9
15+ Build-Depends: base>=4.8 && < 5.0
16 ,ghc >= 7.8 && <= 8.0.1
16 ,ghc >= 7.8 && <= 8.0.1
17 ,ghc-paths
17 ,ghc-paths
18 ,mtl
18 ,mtl
@@ -51,7 +51,7 @@ Library
51 ,extended-reals
51 ,extended-reals
52 ,network-transport
52 ,network-transport
53--required for persistent db driver
53--required for persistent db driver
54− ,persistent >= 2.2 && < 2.3
54+ ,persistent >= 2.2 && <2.3
55 ,persistent-template
55 ,persistent-template
56 ,aeson
56 ,aeson
57 ,path-pieces
57 ,path-pieces
@@ -60,12 +60,10 @@ Library
60 ,http-api-data
60 ,http-api-data
61--needed for remote access
61--needed for remote access
62 ,distributed-process-client-server
62 ,distributed-process-client-server
63− ,distributed-process-extras
64− ,distributed-process-async
65 ,distributed-process
63 ,distributed-process
64+ ,distributed-process-extras
66 ,network-transport-tcp
65 ,network-transport-tcp
67 ,network-transport
66 ,network-transport
68− ,distributed-process
69 ,stm-containers
67 ,stm-containers
70 ,list-t
68 ,list-t
71 ,optparse-applicative
69 ,optparse-applicative
@@ -104,7 +102,6 @@ Library
104 ProjectM36.AtomType,
102 ProjectM36.AtomType,
105 ProjectM36.AtomFunctions.Basic,
103 ProjectM36.AtomFunctions.Basic,
106 ProjectM36.AtomFunctions.Primitive,
104 ProjectM36.AtomFunctions.Primitive,
107− ProjectM36.ConcreteTypeRep,
108 ProjectM36.DataConstructorDef,
105 ProjectM36.DataConstructorDef,
109 ProjectM36.DataTypes.Basic,
106 ProjectM36.DataTypes.Basic,
110 ProjectM36.DataTypes.Day,
107 ProjectM36.DataTypes.Day,
@@ -124,7 +121,7 @@ Library
124 ProjectM36.Transaction.Persist,
121 ProjectM36.Transaction.Persist,
125 ProjectM36.TypeConstructor,
122 ProjectM36.TypeConstructor,
126 ProjectM36.TypeConstructorDef
123 ProjectM36.TypeConstructorDef
127− GHC-Options: -Wall -rtsopts
124+ GHC-Options: -Wall
128 if os(windows)
125 if os(windows)
129 Build-Depends: Win32 >= 2.3 && < 2.4
126 Build-Depends: Win32 >= 2.3 && < 2.4
130 Other-Modules: ProjectM36.Win32Handle
127 Other-Modules: ProjectM36.Win32Handle
@@ -134,10 +131,13 @@ Library
134 CC-Options: -fPIC
131 CC-Options: -fPIC
135 Hs-Source-Dirs: ./src/lib
132 Hs-Source-Dirs: ./src/lib
136 Default-Language: Haskell2010
133 Default-Language: Haskell2010
137− Default-Extensions: OverloadedStrings
134+ Default-Extensions: OverloadedStrings, CPP
135+ if impl(ghc>= 8)
136+ build-depends:
137+ ghc-boot
138
138
139Executable tutd
139Executable tutd
140− Build-Depends: base >=4.8 && <4.9,
140+ Build-Depends: base >=4.8 && <5.0,
141 ghc >= 7.8 && <= 8.0.1,
141 ghc >= 7.8 && <= 8.0.1,
142 ghc-paths,
142 ghc-paths,
143 project-m36 == 0.1,
143 project-m36 == 0.1,
@@ -155,13 +155,6 @@ Executable tutd
155 time,
155 time,
156 hashable-time,
156 hashable-time,
157 bytestring,
157 bytestring,
158− distributed-process-client-server,
159− distributed-process-extras,
160− distributed-process-async,
161− distributed-process,
162− network-transport-tcp,
163− network-transport,
164− distributed-process,
165 stm,
158 stm,
166 deepseq,
159 deepseq,
167 binary,
160 binary,
@@ -217,13 +210,6 @@ Executable project-m36-server
217 ghc >= 7.8 && <= 8.0.1,
210 ghc >= 7.8 && <= 8.0.1,
218 ghc-paths,
211 ghc-paths,
219 project-m36 == 0.1,
212 project-m36 == 0.1,
220− distributed-process-client-server,
221− distributed-process-extras,
222− distributed-process-async,
223− distributed-process,
224− network-transport-tcp,
225− network-transport,
226− distributed-process,
227 binary,
213 binary,
228 transformers,
214 transformers,
229 temporary,
215 temporary,
@@ -260,7 +246,7 @@ Executable project-m36-server
260Executable bigrel
246Executable bigrel
261 Default-Language: Haskell2010
247 Default-Language: Haskell2010
262 Default-Extensions: OverloadedStrings
248 Default-Extensions: OverloadedStrings
263− Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, network-transport-tcp, distributed-process, distributed-process-extras, distributed-process-client-server, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, optparse-applicative, stm-containers, list-t, ghc, ghc-paths, transformers, project-m36 == 0.1, MonadRandom
249+ 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, optparse-applicative, stm-containers, list-t, ghc, ghc-paths, transformers, project-m36 == 0.1, MonadRandom
264 Other-Modules: TutorialD.Interpreter.Base,
250 Other-Modules: TutorialD.Interpreter.Base,
265 TutorialD.Interpreter.DatabaseContextExpr,
251 TutorialD.Interpreter.DatabaseContextExpr,
266 TutorialD.Interpreter.RelationalExpr,
252 TutorialD.Interpreter.RelationalExpr,
@@ -276,7 +262,7 @@ Test-Suite test-tutoriald
276 Default-Extensions: OverloadedStrings
262 Default-Extensions: OverloadedStrings
277 type: exitcode-stdio-1.0
263 type: exitcode-stdio-1.0
278 main-is: test/TutorialD/Interpreter.hs
264 main-is: test/TutorialD/Interpreter.hs
279− Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, network-transport-tcp, distributed-process, distributed-process-extras, distributed-process-client-server, 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 == 0.1, MonadRandom
265+ 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 == 0.1, MonadRandom
280 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
266 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
281 GHC-Options: -Wall
267 GHC-Options: -Wall
282 Hs-Source-Dirs: ./src/bin, ., test
268 Hs-Source-Dirs: ./src/bin, ., test
@@ -298,7 +284,7 @@ Test-Suite test-relation
298 Default-Extensions: OverloadedStrings
284 Default-Extensions: OverloadedStrings
299 type: exitcode-stdio-1.0
285 type: exitcode-stdio-1.0
300 main-is: test/Relation/Basic.hs
286 main-is: test/Relation/Basic.hs
301− Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, network-transport-tcp, distributed-process, distributed-process-extras, distributed-process-client-server, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, stm-containers, project-m36 == 0.1
287+ 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 == 0.1
302 GHC-Options: -Wall
288 GHC-Options: -Wall
303
289
304Test-Suite test-static-optimizer
290Test-Suite test-static-optimizer
@@ -306,7 +292,7 @@ Test-Suite test-static-optimizer
306 Default-Extensions: OverloadedStrings
292 Default-Extensions: OverloadedStrings
307 type: exitcode-stdio-1.0
293 type: exitcode-stdio-1.0
308 main-is: test/Relation/StaticOptimizer.hs
294 main-is: test/Relation/StaticOptimizer.hs
309− Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, network-transport-tcp, distributed-process, distributed-process-extras, distributed-process-client-server, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, stm-containers, project-m36 == 0.1
295+ 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 == 0.1
310 GHC-Options: -Wall
296 GHC-Options: -Wall
311 CPP-Options: -DPROJECTM36_VERSION="v0.1"
297 CPP-Options: -DPROJECTM36_VERSION="v0.1"
312
298
@@ -315,7 +301,7 @@ Test-Suite test-transactiongraph-persist
315 Default-Extensions: OverloadedStrings
301 Default-Extensions: OverloadedStrings
316 type: exitcode-stdio-1.0
302 type: exitcode-stdio-1.0
317 main-is: test/TransactionGraph/Persist.hs
303 main-is: test/TransactionGraph/Persist.hs
318− Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, network-transport-tcp, distributed-process, distributed-process-extras, distributed-process-client-server, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, stm-containers, project-m36 == 0.1, MonadRandom
304+ 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 == 0.1, MonadRandom
319 Other-Modules: TutorialD.Interpreter.Base, TutorialD.Interpreter.RelationalExpr, TutorialD.Interpreter.Types, TutorialD.Interpreter.DatabaseContextExpr, TutorialD.Interpreter.Import.BasicExamples
305 Other-Modules: TutorialD.Interpreter.Base, TutorialD.Interpreter.RelationalExpr, TutorialD.Interpreter.Types, TutorialD.Interpreter.DatabaseContextExpr, TutorialD.Interpreter.Import.BasicExamples
320 Hs-Source-Dirs: ., ./src/bin
306 Hs-Source-Dirs: ., ./src/bin
321 GHC-Options: -Wall
307 GHC-Options: -Wall
@@ -325,7 +311,7 @@ Test-Suite test-relation-import-csv
325 Default-Extensions: OverloadedStrings
311 Default-Extensions: OverloadedStrings
326 type: exitcode-stdio-1.0
312 type: exitcode-stdio-1.0
327 main-is: test/Relation/Import/CSV.hs
313 main-is: test/Relation/Import/CSV.hs
328− Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, network-transport-tcp, distributed-process, distributed-process-extras, distributed-process-client-server, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, stm-containers, project-m36 == 0.1
314+ 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 == 0.1
329 GHC-Options: -Wall
315 GHC-Options: -Wall
330 CPP-Options: -DPROJECTM36_VERSION="v0.1"
316 CPP-Options: -DPROJECTM36_VERSION="v0.1"
331
317
@@ -334,7 +320,7 @@ Test-Suite test-tutoriald-import-tutoriald
334 Default-Extensions: OverloadedStrings
320 Default-Extensions: OverloadedStrings
335 type: exitcode-stdio-1.0
321 type: exitcode-stdio-1.0
336 main-is: test/TutorialD/Interpreter/Import/TutorialD.hs
322 main-is: test/TutorialD/Interpreter/Import/TutorialD.hs
337− Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, network-transport-tcp, distributed-process, distributed-process-extras, distributed-process-client-server, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, stm-containers, project-m36 == 0.1, MonadRandom
323+ 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 == 0.1, MonadRandom
338 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
324 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
339 GHC-Options: -Wall
325 GHC-Options: -Wall
340 Hs-Source-Dirs: ., ./src/bin
326 Hs-Source-Dirs: ., ./src/bin
@@ -344,7 +330,7 @@ Test-Suite test-relation-export-csv
344 Default-Extensions: OverloadedStrings
330 Default-Extensions: OverloadedStrings
345 type: exitcode-stdio-1.0
331 type: exitcode-stdio-1.0
346 main-is: test/Relation/Export/CSV.hs
332 main-is: test/Relation/Export/CSV.hs
347− Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, network-transport-tcp, distributed-process, distributed-process-extras, distributed-process-client-server, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, stm-containers, project-m36 == 0.1
333+ 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 == 0.1
348 GHC-Options: -Wall
334 GHC-Options: -Wall
349
335
350Test-Suite test-persistent-driver
336Test-Suite test-persistent-driver
@@ -353,7 +339,7 @@ Test-Suite test-persistent-driver
353 type: exitcode-stdio-1.0
339 type: exitcode-stdio-1.0
354 main-is: test/persistent-driver/test.hs
340 main-is: test/persistent-driver/test.hs
355 Other-Modules: Database.Persist.ProjectM36
341 Other-Modules: Database.Persist.ProjectM36
356− Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, network-transport-tcp, distributed-process, distributed-process-extras, distributed-process-client-server, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, template-haskell, transformers, aeson, persistent-template, conduit, persistent >= 2.2 && < 2.3, either, path-pieces, http-api-data, stm-containers, list-t, project-m36 == 0.1
342+ 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, persistent-template, conduit, persistent, either, path-pieces, http-api-data, stm-containers, list-t, project-m36 == 0.1
357 Hs-Source-Dirs: ., src/persistent
343 Hs-Source-Dirs: ., src/persistent
358 GHC-Options: -Wall
344 GHC-Options: -Wall
359
345
@@ -362,7 +348,7 @@ Test-Suite test-transactiongraph-merge
362 Default-Extensions: OverloadedStrings
348 Default-Extensions: OverloadedStrings
363 type: exitcode-stdio-1.0
349 type: exitcode-stdio-1.0
364 main-is: test/TransactionGraph/Merge.hs
350 main-is: test/TransactionGraph/Merge.hs
365− Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, network-transport-tcp, distributed-process, distributed-process-extras, distributed-process-client-server, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, template-haskell, transformers, aeson, persistent-template, conduit, persistent, either, path-pieces, http-api-data, stm-containers, list-t, project-m36 == 0.1
351+ 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, persistent-template, conduit, persistent, either, path-pieces, http-api-data, stm-containers, list-t, project-m36 == 0.1
366 GHC-Options: -Wall
352 GHC-Options: -Wall
367
353
368benchmark bench
354benchmark bench
@@ -370,7 +356,7 @@ benchmark bench
370 Default-Extensions: OverloadedStrings
356 Default-Extensions: OverloadedStrings
371 type: exitcode-stdio-1.0
357 type: exitcode-stdio-1.0
372 main-is: benchmark/Relation.hs
358 main-is: benchmark/Relation.hs
373− Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, network-transport-tcp, distributed-process, distributed-process-extras, distributed-process-client-server, 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 == 0.1
359+ 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 == 0.1
374 GHC-Options: -Wall -rtsopts
360 GHC-Options: -Wall -rtsopts
375 Hs-Source-Dirs: ./src/bin
361 Hs-Source-Dirs: ./src/bin
376
362
@@ -379,21 +365,21 @@ Test-Suite test-server
379 Default-Extensions: OverloadedStrings
365 Default-Extensions: OverloadedStrings
380 type: exitcode-stdio-1.0
366 type: exitcode-stdio-1.0
381 main-is: test/Server/Main.hs
367 main-is: test/Server/Main.hs
382− Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, network-transport-tcp, distributed-process, distributed-process-extras, distributed-process-client-server, 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 == 0.1
368+ 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 == 0.1
383 HS-Source-Dirs: ., ./src/bin
369 HS-Source-Dirs: ., ./src/bin
384 GHC-Options: -Wall
370 GHC-Options: -Wall
385
371
386Executable Example-SimpleClient
372Executable Example-SimpleClient
387 Default-Language: Haskell2010
373 Default-Language: Haskell2010
388 Default-Extensions: OverloadedStrings
374 Default-Extensions: OverloadedStrings
389− Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, network-transport-tcp, distributed-process, distributed-process-extras, distributed-process-client-server, 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 == 0.1, MonadRandom
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, ghc, ghc-paths, project-m36 == 0.1, MonadRandom
390 Main-Is: examples/SimpleClient.hs
376 Main-Is: examples/SimpleClient.hs
391 GHC-Options: -Wall
377 GHC-Options: -Wall
392
378
393Executable Example-PersistClient
379Executable Example-PersistClient
394 Default-Language: Haskell2010
380 Default-Language: Haskell2010
395 Default-Extensions: OverloadedStrings
381 Default-Extensions: OverloadedStrings
396− Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, network-transport-tcp, distributed-process, distributed-process-extras, distributed-process-client-server, 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, persistent, aeson, path-pieces, either, conduit, http-api-data, template-haskell, persistent-template, ghc, ghc-paths, project-m36 == 0.1
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, transformers, stm-containers, list-t, persistent, aeson, path-pieces, either, conduit, http-api-data, template-haskell, persistent-template, ghc, ghc-paths, project-m36 == 0.1
397 Main-Is: examples/PersistClient.hs
383 Main-Is: examples/PersistClient.hs
398 GHC-Options: -Wall
384 GHC-Options: -Wall
399 CPP-Options: -DPROJECTM36_VERSION="v0.1"
385 CPP-Options: -DPROJECTM36_VERSION="v0.1"
@@ -405,7 +391,7 @@ Test-Suite test-scripts
405 Default-Extensions: OverloadedStrings
391 Default-Extensions: OverloadedStrings
406 type: exitcode-stdio-1.0
392 type: exitcode-stdio-1.0
407 main-is: test/scripts.hs
393 main-is: test/scripts.hs
408− Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, network-transport-tcp, distributed-process, distributed-process-extras, distributed-process-client-server, 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 == 0.1, MonadRandom
394+ 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 == 0.1, MonadRandom
409 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
395 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
410 GHC-Options: -Wall
396 GHC-Options: -Wall
411 Hs-Source-Dirs: ., ./src/bin
397 Hs-Source-Dirs: ., ./src/bin
@@ -424,7 +410,7 @@ Test-Suite test-websocket-server
424 Default-Language: Haskell2010
410 Default-Language: Haskell2010
425 type: exitcode-stdio-1.0
411 type: exitcode-stdio-1.0
426 main-is: test/Server/WebSocket.hs
412 main-is: test/Server/WebSocket.hs
427− Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, network-transport-tcp, distributed-process, distributed-process-extras, distributed-process-client-server, 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, uuid-aeson, project-m36 == 0.1, MonadRandom
413+ 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, uuid-aeson, project-m36 == 0.1, MonadRandom
428 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
414 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
429 Default-Extensions: OverloadedStrings
415 Default-Extensions: OverloadedStrings
430 GHC-Options: -Wall
416 GHC-Options: -Wall
@@ -435,7 +421,7 @@ Test-Suite test-isomorphic-schemas
435 Default-Language: Haskell2010
421 Default-Language: Haskell2010
436 type: exitcode-stdio-1.0
422 type: exitcode-stdio-1.0
437 main-is: test/IsomorphicSchema.hs
423 main-is: test/IsomorphicSchema.hs
438− Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, network-transport-tcp, distributed-process, distributed-process-extras, distributed-process-client-server, 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, uuid-aeson, project-m36 == 0.1
424+ 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, uuid-aeson, project-m36 == 0.1
439 Default-Extensions: OverloadedStrings
425 Default-Extensions: OverloadedStrings
440 GHC-Options: -Wall
426 GHC-Options: -Wall
441 Hs-Source-Dirs: ./src/bin, .
427 Hs-Source-Dirs: ./src/bin, .
src/bin/ProjectM36/Server/RemoteCallTypes/Json.hs−14
@@ -4,7 +4,6 @@
4module ProjectM36.Server.RemoteCallTypes.Json where
4module ProjectM36.Server.RemoteCallTypes.Json where
5import ProjectM36.Server.RemoteCallTypes
5import ProjectM36.Server.RemoteCallTypes
6import ProjectM36.Base
6import ProjectM36.Base
7−import ProjectM36.ConcreteTypeRep
8import ProjectM36.Error
7import ProjectM36.Error
9import ProjectM36.DataTypes.Primitive
8import ProjectM36.DataTypes.Primitive
10import ProjectM36.IsomorphicSchema
9import ProjectM36.IsomorphicSchema
@@ -60,25 +59,12 @@ instance FromJSON TypeConstructor
60instance ToJSON TypeConstructorArg
59instance ToJSON TypeConstructorArg
61instance FromJSON TypeConstructorArg
60instance FromJSON TypeConstructorArg
62
61
63−instance ToJSON SerialRep
64−instance FromJSON SerialRep
65−
66instance ToJSON SchemaExpr
62instance ToJSON SchemaExpr
67instance FromJSON SchemaExpr
63instance FromJSON SchemaExpr
68
64
69instance ToJSON SchemaIsomorph
65instance ToJSON SchemaIsomorph
70instance FromJSON SchemaIsomorph
66instance FromJSON SchemaIsomorph
71
67
72−instance FromJSON ConcreteTypeRep where
73− parseJSON = withObject "ctr" $ \o -> do
74− serialRep <- o .: "serialrep"
75− pure $ fromSerial serialRep
76−
77−instance ToJSON ConcreteTypeRep where
78− toJSON ctr = object [
79− "serialrep" .= toSerial ctr
80− ]
81−
82instance ToJSON Atom where
68instance ToJSON Atom where
83 toJSON atom@(IntAtom i) = object [ "type" .= atomTypeForAtom atom,
69 toJSON atom@(IntAtom i) = object [ "type" .= atomTypeForAtom atom,
84 "val" .= i ]
70 "val" .= i ]
src/bin/TutorialD/Interpreter/RelationalExpr.hs+6−6
@@ -65,7 +65,7 @@ tupleAtomExprP = do
65 atomExpr <- atomExprP
65 atomExpr <- atomExprP
66 pure $ (attributeName, atomExpr)
66 pure $ (attributeName, atomExpr)
67
67
68−projectP :: RelationalMarkerExpr a => Parser (RelationalExprBase a -> RelationalExprBase a)
68+projectP :: Parser (RelationalExprBase a -> RelationalExprBase a)
69projectP = do
69projectP = do
70 attrs <- braces attributeListP
70 attrs <- braces attributeListP
71 pure $ Project attrs
71 pure $ Project attrs
@@ -77,7 +77,7 @@ renameClauseP = do
77 newAttr <- identifier
77 newAttr <- identifier
78 pure $ (oldAttr, newAttr)
78 pure $ (oldAttr, newAttr)
79
79
80−renameP :: RelationalMarkerExpr a => Parser (RelationalExprBase a -> RelationalExprBase a)
80+renameP :: Parser (RelationalExprBase a -> RelationalExprBase a)
81renameP = do
81renameP = do
82 reservedOp "rename"
82 reservedOp "rename"
83 renameList <- braces (sepBy renameClauseP comma)
83 renameList <- braces (sepBy renameClauseP comma)
@@ -96,14 +96,14 @@ groupClauseP = do
96 newAttrName <- identifier
96 newAttrName <- identifier
97 return $ (attrs, newAttrName)
97 return $ (attrs, newAttrName)
98
98
99−groupP :: RelationalMarkerExpr a => Parser (RelationalExprBase a -> RelationalExprBase a)
99+groupP :: Parser (RelationalExprBase a -> RelationalExprBase a)
100groupP = do
100groupP = do
101 reservedOp "group"
101 reservedOp "group"
102 (groupAttrList, groupAttrName) <- parens groupClauseP
102 (groupAttrList, groupAttrName) <- parens groupClauseP
103 pure $ Group groupAttrList groupAttrName
103 pure $ Group groupAttrList groupAttrName
104
104
105--in "Time and Relational Theory" (2014), Date's Tutorial D grammar for ungroup takes one attribute, while in previous books, it take multiple arguments. Let us assume that nested ungroups are the same as multiple attributes.
105--in "Time and Relational Theory" (2014), Date's Tutorial D grammar for ungroup takes one attribute, while in previous books, it take multiple arguments. Let us assume that nested ungroups are the same as multiple attributes.
106−ungroupP :: RelationalMarkerExpr a => Parser (RelationalExprBase a -> RelationalExprBase a)
106+ungroupP :: Parser (RelationalExprBase a -> RelationalExprBase a)
107ungroupP = do
107ungroupP = do
108 reservedOp "ungroup"
108 reservedOp "ungroup"
109 rvaAttrName <- identifier
109 rvaAttrName <- identifier
@@ -195,13 +195,13 @@ consumeAtomExprP consume = try functionAtomExprP <|>
195 nakedAtomExprP <|>
195 nakedAtomExprP <|>
196 relationalAtomExprP
196 relationalAtomExprP
197
197
198−attributeAtomExprP :: RelationalMarkerExpr a => Parser (AtomExprBase a)
198+attributeAtomExprP :: Parser (AtomExprBase a)
199attributeAtomExprP = do
199attributeAtomExprP = do
200 _ <- string "@"
200 _ <- string "@"
201 attrName <- identifier
201 attrName <- identifier
202 return $ AttributeAtomExpr attrName
202 return $ AttributeAtomExpr attrName
203
203
204−nakedAtomExprP :: RelationalMarkerExpr a => Parser (AtomExprBase a)
204+nakedAtomExprP :: Parser (AtomExprBase a)
205nakedAtomExprP = NakedAtomExpr <$> atomP
205nakedAtomExprP = NakedAtomExpr <$> atomP
206
206
207constructedAtomExprP :: RelationalMarkerExpr a => Bool -> Parser (AtomExprBase a)
207constructedAtomExprP :: RelationalMarkerExpr a => Bool -> Parser (AtomExprBase a)
src/bin/TutorialD/tutd.hs+3
@@ -5,6 +5,9 @@ import ProjectM36.Client
5import System.IO
5import System.IO
6import Options.Applicative
6import Options.Applicative
7import System.Exit
7import System.Exit
8+#if __GLASGOW_HASKELL__ >= 800
9+import Data.Monoid
10+#endif
8
11
9parseArgs :: Parser InterpreterConfig
12parseArgs :: Parser InterpreterConfig
10parseArgs = LocalInterpreterConfig <$> parsePersistenceStrategy <*> parseHeadName <*> parseGhcPkgPaths <|>
13parseArgs = LocalInterpreterConfig <$> parsePersistenceStrategy <*> parseHeadName <*> parseGhcPkgPaths <|>
src/bin/benchmark/bigrel.hs+1
@@ -22,6 +22,7 @@ import System.IO
22import Control.Monad.State
22import Control.Monad.State
23import Control.DeepSeq
23import Control.DeepSeq
24import Data.Text hiding (map)
24import Data.Text hiding (map)
25+import Data.Monoid
25
26
26dumpcsv :: Relation -> IO ()
27dumpcsv :: Relation -> IO ()
27dumpcsv rel = case relationAsCSV rel of
28dumpcsv rel = case relationAsCSV rel of
src/lib/ProjectM36/AtomFunctionBody.hs+40−24
@@ -6,17 +6,21 @@ import ProjectM36.Error
6
6
7import Control.Monad.IO.Class
7import Control.Monad.IO.Class
8import Control.Exception
8import Control.Exception
9−import Data.Text hiding (map)
9+import Data.Text hiding (map, foldl)
10
10
11import Unsafe.Coerce
11import Unsafe.Coerce
12import GHC
12import GHC
13import GHC.Paths (libdir)
13import GHC.Paths (libdir)
14+#if __GLASGOW_HASKELL__ >= 800
15+import GHC.LanguageExtensions
16+#endif
14import DynFlags
17import DynFlags
15import Panic
18import Panic
16−import Outputable hiding ((<>))
19+import Outputable --hiding ((<>))
17import PprTyThing
20import PprTyThing
18import Type hiding (pprTyThing)
21import Type hiding (pprTyThing)
19import System.FilePath.Glob
22import System.FilePath.Glob
23+import Debug.Trace
20
24
21data ScriptSession = ScriptSession {
25data ScriptSession = ScriptSession {
22 hscEnv :: HscEnv,
26 hscEnv :: HscEnv,
@@ -36,34 +40,46 @@ initScriptSession ghcPkgPaths = do
36 dflags <- getSessionDynFlags
40 dflags <- getSessionDynFlags
37 let localPkgPaths = map PkgConfFile (ghcPkgPaths ++ sandboxPkgPaths)
41 let localPkgPaths = map PkgConfFile (ghcPkgPaths ++ sandboxPkgPaths)
38
42
39− let dflags' = dflags { hscTarget = HscInterpreted ,
43+ let dflags' = applyGopts . applyXopts $ dflags { hscTarget = HscInterpreted ,
40 ghcLink = LinkInMemory,
44 ghcLink = LinkInMemory,
41 safeHaskell = Sf_Trustworthy,
45 safeHaskell = Sf_Trustworthy,
42 safeInfer = True,
46 safeInfer = True,
43 safeInferred = True,
47 safeInferred = True,
48+ --verbosity = 3,
49+#if __GLASGOW_HASKELL__ >= 800
44− --trustFlags = [TrustPackage "base"] -- new in 8
50+ trustFlags = map TrustPackage required_packages,
51+#endif
45 packageFlags = (packageFlags dflags) ++ packages,
52 packageFlags = (packageFlags dflags) ++ packages,
46− extraPkgConfs = const ([GlobalPkgConf, UserPkgConf] ++ localPkgPaths)
53+ extraPkgConfs = const (localPkgPaths ++ [UserPkgConf, GlobalPkgConf])
47 }
54 }
48− `xopt_set` Opt_ExtendedDefaultRules
55+ applyGopts flags = foldl gopt_set flags gopts
49− `xopt_set` Opt_ImplicitPrelude
56+ applyXopts flags = foldl xopt_set flags xopts
50− `xopt_set` Opt_OverloadedStrings
57+#if __GLASGOW_HASKELL__ >= 800
58+ xopts = [OverloadedStrings, ExtendedDefaultRules, ImplicitPrelude, ScopedTypeVariables]
59+#else
60+ xopts = [Opt_OverloadedStrings, Opt_ExtendedDefaultRules, Opt_ImplicitPrelude, Opt_ScopedTypeVariables]
61+#endif
51− `gopt_set` Opt_DistrustAllPackages
62+ gopts = [] --[Opt_DistrustAllPackages, Opt_PackageTrust]
52− `xopt_set` Opt_ScopedTypeVariables
63+ required_packages = ["base",
53− `gopt_set` Opt_PackageTrust
54− --`gopt_set` Opt_ImplicitImportQualified
55− packages = map TrustPackage ["base",
56− "containers",
64+ "containers",
65+ "Glob",
66+ "directory",
57− "unordered-containers",
67+ "unordered-containers",
58− "hashable",
68+ "hashable",
59− "uuid",
69+ "uuid",
60− "vector",
70+ "vector",
61− "text",
71+ "text",
62− "binary",
72+ "binary",
63− "vector-binary-instances",
73+ "vector-binary-instances",
64− "time",
74+ "time",
65− "project-m36",
75+ "project-m36",
66− "bytestring"] -- package flags changed in 8.0
76+ "bytestring"]
77+#if __GLASGOW_HASKELL__ >= 800
78+ packages = map (\m -> ExposePackage ("-package " ++ m) (PackageArg m) (ModRenaming True [])) required_packages
79+#else
80+ packages = map TrustPackage required_packages
81+#endif
82+ --liftIO $ traceShowM (showSDoc dflags' (ppr packages))
67 _ <- setSessionDynFlags dflags'
83 _ <- setSessionDynFlags dflags'
68 let safeImportDecl mn = ImportDecl {
84 let safeImportDecl mn = ImportDecl {
69 ideclSourceSrc = Nothing,
85 ideclSourceSrc = Nothing,
src/lib/ProjectM36/ConcreteTypeRep.hsdeleted−34
@@ -1,34 +0,0 @@
1−{-# LANGUAGE GeneralizedNewtypeDeriving, DeriveGeneric #-}
2−-- adapted from https://hackage.haskell.org/package/concrete-typerep
3−module ProjectM36.ConcreteTypeRep where
4−import Data.Binary
5−import Data.Typeable
6−import Data.Typeable.Internal
7−import Control.DeepSeq (NFData)
8−import GHC.Generics
9−
10−newtype ConcreteTypeRep = CTR { unCTR :: TypeRep } deriving (Eq, Typeable, NFData)
11−
12−newtype SerialRep = SR (TyConRep, [SerialRep]) deriving (Binary, Generic)
13−
14−instance Show ConcreteTypeRep where
15− show (CTR tRep) = show tRep
16−
17−type TyConRep = (String, String, String)
18−toTyConRep :: TyCon -> TyConRep
19−toTyConRep (TyCon _ pack modul name) = (pack, modul, name)
20−
21−fromTyConRep :: TyConRep -> TyCon
22−fromTyConRep (pack, modul, name) = mkTyCon3 pack modul name
23−
24−toSerial :: ConcreteTypeRep -> SerialRep
25−toSerial (CTR t) = case splitTyConApp t of
26− (con, args) -> SR (toTyConRep con, map (toSerial . CTR) args)
27−
28−fromSerial :: SerialRep -> ConcreteTypeRep
29−fromSerial (SR (con, args)) = CTR $ mkTyConApp (fromTyConRep con) (map (unCTR . fromSerial) args)
30−
31−instance Binary ConcreteTypeRep where
32− put = put . toSerial
33− get = fromSerial <$> get
34−
src/lib/ProjectM36/Server/ParseArgs.hs+1
@@ -3,6 +3,7 @@ import ProjectM36.Base
3import ProjectM36.Client
3import ProjectM36.Client
4import Options.Applicative
4import Options.Applicative
5import ProjectM36.Server.Config
5import ProjectM36.Server.Config
6+import Data.Monoid
6
7
7parseArgs :: Parser ServerConfig
8parseArgs :: Parser ServerConfig
8parseArgs = ServerConfig <$> parsePersistenceStrategy <*> parseDatabaseName <*> parseHostname <*> parsePort <*> many parseGhcPkgPaths
9parseArgs = ServerConfig <$> parsePersistenceStrategy <*> parseDatabaseName <*> parseHostname <*> parsePort <*> many parseGhcPkgPaths
src/lib/ProjectM36/TransactionGraph/Merge.hs+1−1
@@ -12,7 +12,7 @@ import qualified Data.HashSet as HS
12data MergePreference = PreferFirst | PreferSecond | PreferNeither
12data MergePreference = PreferFirst | PreferSecond | PreferNeither
13
13
14-- Check for overlapping keys. If the values differ, try a preference resolution
14-- Check for overlapping keys. If the values differ, try a preference resolution
15−unionMergeMaps :: (Ord k, Eq k, Eq a) => MergePreference -> M.Map k a -> M.Map k a -> Either MergeError (M.Map k a)
15+unionMergeMaps :: (Ord k, Eq a) => MergePreference -> M.Map k a -> M.Map k a -> Either MergeError (M.Map k a)
16unionMergeMaps prefer mapA mapB = case prefer of
16unionMergeMaps prefer mapA mapB = case prefer of
17 PreferFirst -> pure $ M.union mapA mapB
17 PreferFirst -> pure $ M.union mapA mapB
18 PreferSecond -> pure $ M.union mapB mapA
18 PreferSecond -> pure $ M.union mapB mapA
src/persistent/Database/Persist/ProjectM36.hs+14−20
@@ -36,7 +36,7 @@ import Web.HttpApiData (ToHttpApiData(..), FromHttpApiData(..), parseUrlPieceWit
36type ProjectM36Backend = (C.SessionId, C.Connection)
36type ProjectM36Backend = (C.SessionId, C.Connection)
37
37
38--convert a PersistEntity to a RelationTuple
38--convert a PersistEntity to a RelationTuple
39−recordAsTuple :: forall record. (PersistEntity record, PersistEntityBackend record ~ ProjectM36Backend)
39+recordAsTuple :: forall record. (PersistEntity record)
40 => Maybe U.UUID -> record -> Either RelationalError RelationTuple
40 => Maybe U.UUID -> record -> Either RelationalError RelationTuple
41recordAsTuple uuid record = do -- if the uuid is passed in, set the idDBName attribute
41recordAsTuple uuid record = do -- if the uuid is passed in, set the idDBName attribute
42 let entInfo = zip entFields entValues
42 let entInfo = zip entFields entValues
@@ -46,7 +46,7 @@ recordAsTuple uuid record = do -- if the uuid is passed in, set the idDBName att
46 atomVec <- recordAsAtoms uuid attrVec record
46 atomVec <- recordAsAtoms uuid attrVec record
47 return $ RelationTuple attrVec atomVec
47 return $ RelationTuple attrVec atomVec
48
48
49−recordAttributes :: forall record. (PersistEntity record, PersistEntityBackend record ~ ProjectM36Backend)
49+recordAttributes :: forall record. (PersistEntity record)
50 => [(EmbedFieldDef, PersistValue)] -> record -> Either RelationalError Attributes
50 => [(EmbedFieldDef, PersistValue)] -> record -> Either RelationalError Attributes
51recordAttributes entInfo record = do
51recordAttributes entInfo record = do
52 let convertAttr = uncurry fieldDefAsAttribute
52 let convertAttr = uncurry fieldDefAsAttribute
@@ -86,7 +86,7 @@ atomAsPersistValue (ByteStringAtom i) = PersistByteString i
86atomAsPersistValue (BoolAtom i) = PersistBool i
86atomAsPersistValue (BoolAtom i) = PersistBool i
87atomAsPersistValue _ = error "Persist: missing conversion"
87atomAsPersistValue _ = error "Persist: missing conversion"
88
88
89−recordAsAtoms :: forall record. (PersistEntity record, PersistEntityBackend record ~ ProjectM36Backend)
89+recordAsAtoms :: forall record. (PersistEntity record)
90 => Maybe U.UUID -> Attributes -> record -> Either RelationalError (V.Vector Atom)
90 => Maybe U.UUID -> Attributes -> record -> Either RelationalError (V.Vector Atom)
91recordAsAtoms freshUUID _ record = do
91recordAsAtoms freshUUID _ record = do
92 let pValues = map toPersistValue $ toPersistFields record
92 let pValues = map toPersistValue $ toPersistFields record
@@ -99,7 +99,7 @@ recordAsAtoms freshUUID _ record = do
99 Just uuid -> [TextAtom $ T.pack (U.toString uuid)] ++ atoms
99 Just uuid -> [TextAtom $ T.pack (U.toString uuid)] ++ atoms
100
100
101--used by insert operations
101--used by insert operations
102−recordsAsRelation :: forall record. (PersistEntity record, PersistEntityBackend record ~ ProjectM36Backend) =>
102+recordsAsRelation :: forall record. (PersistEntity record) =>
103 [(Maybe U.UUID, record)] -> Either RelationalError Relation
103 [(Maybe U.UUID, record)] -> Either RelationalError Relation
104recordsAsRelation [] = Left EmptyTuplesError
104recordsAsRelation [] = Left EmptyTuplesError
105recordsAsRelation recordZips = do
105recordsAsRelation recordZips = do
@@ -108,16 +108,13 @@ recordsAsRelation recordZips = do
108 mkRelation (tupleAttributes oneTuple) (RelationTupleSet tupleList)
108 mkRelation (tupleAttributes oneTuple) (RelationTupleSet tupleList)
109
109
110keyFromValuesOrDie :: (Trans.MonadIO m,
110keyFromValuesOrDie :: (Trans.MonadIO m,
111− PersistEntity record,
112− PersistEntityBackend record ~ ProjectM36Backend
113− ) => [PersistValue] -> m (Key record)
111+ PersistEntity record) => [PersistValue] -> m (Key record)
114keyFromValuesOrDie val = case keyFromValues val of
112keyFromValuesOrDie val = case keyFromValues val of
115 Right k -> return k
113 Right k -> return k
116 Left _ -> Trans.liftIO $ throwIO $ PersistError "key pooped"
114 Left _ -> Trans.liftIO $ throwIO $ PersistError "key pooped"
117
115
118insertNewRecords :: (Trans.MonadIO m,
116insertNewRecords :: (Trans.MonadIO m,
119− PersistEntity record,
117+ PersistEntity record) =>
120− PersistEntityBackend record ~ ProjectM36Backend) =>
121 [U.UUID] -> [record] -> ReaderT ProjectM36Backend m [Key record]
118 [U.UUID] -> [record] -> ReaderT ProjectM36Backend m [Key record]
122insertNewRecords uuids records = do
119insertNewRecords uuids records = do
123 let recordsZip = zip (map Just uuids) records
120 let recordsZip = zip (map Just uuids) records
@@ -134,8 +131,7 @@ throwIOPersistError msg = Trans.liftIO $ throwIO $ PersistError (T.pack msg)
134
131
135lookupByKey :: forall record m.
132lookupByKey :: forall record m.
136 (Trans.MonadIO m,
133 (Trans.MonadIO m,
137− PersistEntity record,
134+ PersistEntity record)
138− PersistEntityBackend record ~ ProjectM36Backend)
139 => Key record -> ReaderT ProjectM36Backend m (Maybe (Entity record))
135 => Key record -> ReaderT ProjectM36Backend m (Maybe (Entity record))
140lookupByKey key = do
136lookupByKey key = do
141 (relVarName, restrictionPredicate) <- commonKeyQueryProperties key
137 (relVarName, restrictionPredicate) <- commonKeyQueryProperties key
@@ -152,8 +148,7 @@ lookupByKey key = do
152 return $ Just entity
148 return $ Just entity
153
149
154fromPersistValuesThrow :: (Trans.MonadIO m,
150fromPersistValuesThrow :: (Trans.MonadIO m,
155− PersistEntity record,
156− PersistEntityBackend record ~ ProjectM36Backend) => EntityDef -> RelationTuple -> m (Entity record)
151+ PersistEntity record) => EntityDef -> RelationTuple -> m (Entity record)
157fromPersistValuesThrow entDef tuple = do
152fromPersistValuesThrow entDef tuple = do
158 let body = fromPersistValues $ map getValue (entityFields entDef)
153 let body = fromPersistValues $ map getValue (entityFields entDef)
159 getValue field = case atomForAttributeName (unDBName (fieldDB field)) tuple of
154 getValue field = case atomForAttributeName (unDBName (fieldDB field)) tuple of
@@ -168,7 +163,7 @@ fromPersistValuesThrow entDef tuple = do
168 Left err -> throwIOPersistError (show err)
163 Left err -> throwIOPersistError (show err)
169 Right body' -> return $ Entity key body'
164 Right body' -> return $ Entity key body'
170
165
171−commonKeyQueryProperties :: (Trans.MonadIO m, PersistEntityBackend val ~ ProjectM36Backend, PersistEntity val) => Key val -> ReaderT ProjectM36Backend m (RelVarName, RestrictionPredicateExpr)
166+commonKeyQueryProperties :: (Trans.MonadIO m, PersistEntity val) => Key val -> ReaderT ProjectM36Backend m (RelVarName, RestrictionPredicateExpr)
172commonKeyQueryProperties key = do
167commonKeyQueryProperties key = do
173 let matchUUID = keyToUUID key
168 let matchUUID = keyToUUID key
174 keyAttributeName = unDBName (fieldDB $ entityId entityInfo)
169 keyAttributeName = unDBName (fieldDB $ entityId entityInfo)
@@ -178,7 +173,7 @@ commonKeyQueryProperties key = do
178 restrictionPredicate = AttributeEqualityPredicate keyAttributeName (NakedAtomExpr (TextAtom matchUUIDText))
173 restrictionPredicate = AttributeEqualityPredicate keyAttributeName (NakedAtomExpr (TextAtom matchUUIDText))
179 return (relVarName, restrictionPredicate)
174 return (relVarName, restrictionPredicate)
180
175
181−deleteByKey :: (Trans.MonadIO m, PersistEntityBackend val ~ ProjectM36Backend, PersistEntity val) => Key val -> ReaderT ProjectM36Backend m (Bool)
176+deleteByKey :: (Trans.MonadIO m, PersistEntity val) => Key val -> ReaderT ProjectM36Backend m (Bool)
182deleteByKey key = do
177deleteByKey key = do
183 (relVarName, restrictionPredicate) <- commonKeyQueryProperties key
178 (relVarName, restrictionPredicate) <- commonKeyQueryProperties key
184 let query = Delete relVarName restrictionPredicate
179 let query = Delete relVarName restrictionPredicate
@@ -188,7 +183,6 @@ deleteByKey key = do
188
183
189--convert persistent update list to ProjectM36 Update map
184--convert persistent update list to ProjectM36 Update map
190updatesToUpdateMap :: (Trans.MonadIO m,
185updatesToUpdateMap :: (Trans.MonadIO m,
191− PersistEntityBackend val ~ ProjectM36Backend,
192 PersistEntity val) =>
186 PersistEntity val) =>
193 [DP.Update val] -> ReaderT ProjectM36Backend m (M.Map AttributeName AtomExpr)
187 [DP.Update val] -> ReaderT ProjectM36Backend m (M.Map AttributeName AtomExpr)
194updatesToUpdateMap updates = do
188updatesToUpdateMap updates = do
@@ -202,7 +196,7 @@ updatesToUpdateMap updates = do
202 updateAtomList <- mapM convertMap updates
196 updateAtomList <- mapM convertMap updates
203 return $ M.fromList updateAtomList
197 return $ M.fromList updateAtomList
204
198
205−updateByKey :: (Trans.MonadIO m, PersistEntityBackend val ~ ProjectM36Backend, PersistEntity val) => Key val -> [DP.Update val] -> ReaderT ProjectM36Backend m ()
199+updateByKey :: (Trans.MonadIO m, PersistEntity val) => Key val -> [DP.Update val] -> ReaderT ProjectM36Backend m ()
206updateByKey key updates = do
200updateByKey key updates = do
207 (relVarName, restrictionPredicate) <- commonKeyQueryProperties key
201 (relVarName, restrictionPredicate) <- commonKeyQueryProperties key
208 updateMap <- updatesToUpdateMap updates
202 updateMap <- updatesToUpdateMap updates
@@ -316,7 +310,7 @@ executeDatabaseContextExpr sessionId conn expr = do
316 Nothing -> return ()
310 Nothing -> return ()
317 Just err -> throwIO (PersistError $ T.pack (show err))
311 Just err -> throwIO (PersistError $ T.pack (show err))
318
312
319−relVarNameFromRecord :: (PersistEntity record, PersistEntityBackend record ~ ProjectM36Backend)
313+relVarNameFromRecord :: (PersistEntity record)
320 => record -> RelVarName
314 => record -> RelVarName
321relVarNameFromRecord = unDBName . entityDB . entityDef . Just
315relVarNameFromRecord = unDBName . entityDB . entityDef . Just
322
316
@@ -361,12 +355,12 @@ instance PersistConfig C.ConnectionInfo where
361 --runPool :: (MonadBaseControl IO m, MonadIO m) => c -> PersistConfigBackend c m a -> PersistConfigPool c -> m a
355 --runPool :: (MonadBaseControl IO m, MonadIO m) => c -> PersistConfigBackend c m a -> PersistConfigPool c -> m a
362 runPool _ r = runReaderT r
356 runPool _ r = runReaderT r
363
357
364−withProjectM36Conn :: (Monad m, Trans.MonadIO m) => C.ConnectionInfo -> (ProjectM36Backend -> m a) -> m a
358+withProjectM36Conn :: (Trans.MonadIO m) => C.ConnectionInfo -> (ProjectM36Backend -> m a) -> m a
365withProjectM36Conn conf connReader = do
359withProjectM36Conn conf connReader = do
366 backend <- Trans.liftIO $ createPoolConfig conf
360 backend <- Trans.liftIO $ createPoolConfig conf
367 connReader backend
361 connReader backend
368
362
369−runProjectM36Conn :: (Trans.MonadIO m) => ReaderT ProjectM36Backend m a -> (C.SessionId, C.Connection) -> m a
363+runProjectM36Conn :: ReaderT ProjectM36Backend m a -> (C.SessionId, C.Connection) -> m a
370runProjectM36Conn m1 (sessionId, conn) = runReaderT m1 (sessionId, conn)
364runProjectM36Conn m1 (sessionId, conn) = runReaderT m1 (sessionId, conn)
371
365
372instance PathPiece (BackendKey ProjectM36Backend) where
366instance PathPiece (BackendKey ProjectM36Backend) where
test/TutorialD/Interpreter/AtomFunctionScript.hs+3−2
@@ -37,9 +37,10 @@ testErrorAtomFunction = TestCase $ do
37 let attrs = [Attribute "x" IntAtomType]
37 let attrs = [Attribute "x" IntAtomType]
38 funcAtomExpr = FunctionAtomExpr "mkTest" [NakedAtomExpr (IntAtom 3)] ()
38 funcAtomExpr = FunctionAtomExpr "mkTest" [NakedAtomExpr (IntAtom 3)] ()
39 tupleExprs = [TupleExpr (M.singleton "x" funcAtomExpr)]
39 tupleExprs = [TupleExpr (M.singleton "x" funcAtomExpr)]
40− expectedResult = Left (UnhandledExceptionError "1")
41 result <- executeRelationalExpr sess conn (MakeRelationFromExprs (Just (map NakedAttributeExpr attrs)) tupleExprs)
40 result <- executeRelationalExpr sess conn (MakeRelationFromExprs (Just (map NakedAttributeExpr attrs)) tupleExprs)
42− assertEqual "catch error exception from script" expectedResult result
41+ assertBool "catch error exception from script" (case result of
42+ Left (UnhandledExceptionError _) -> True
43+ _ -> False)
43
44
44testNoArgumentAtomFunction :: Test
45testNoArgumentAtomFunction :: Test
45testNoArgumentAtomFunction = TestCase $ do
46testNoArgumentAtomFunction = TestCase $ do