on master help sign in
implement hlint suggestions
fd31963AgentM
project-m36.cabal+17−64
@@ -214,8 +214,8 @@ Executable project-m36-server
214 Build-Depends: ghc >= 8.2 && < 8.11
214 Build-Depends: ghc >= 8.2 && < 8.11
215 Build-Depends: base,
215 Build-Depends: base,
216 ghc-paths,
216 ghc-paths,
217− project-m36,
218 transformers,
217 transformers,
218+ project-m36,
219 temporary,
219 temporary,
220 data-interval,
220 data-interval,
221 deepseq,
221 deepseq,
@@ -319,48 +319,33 @@ Test-Suite test-relation-import-csv
319 main-is: test/Relation/Import/CSV.hs
319 main-is: test/Relation/Import/CSV.hs
320
320
321Test-Suite test-tutoriald-import-tutoriald
321Test-Suite test-tutoriald-import-tutoriald
322− Default-Language: Haskell2010
322+ import: commontest
323− Default-Extensions: OverloadedStrings
324 type: exitcode-stdio-1.0
323 type: exitcode-stdio-1.0
325 main-is: test/TutorialD/Interpreter/Import/TutorialD.hs
324 main-is: test/TutorialD/Interpreter/Import/TutorialD.hs
326− Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics,parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, stm-containers, project-m36, random, MonadRandom, semigroups, parser-combinators
327 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
325 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
328− GHC-Options: -Wall -threaded
326+
329− Hs-Source-Dirs: ., ./src/bin
330
327
331Test-Suite test-relation-export-csv
328Test-Suite test-relation-export-csv
332− Default-Language: Haskell2010
329+ import: commontest
333− Default-Extensions: OverloadedStrings
334 type: exitcode-stdio-1.0
330 type: exitcode-stdio-1.0
335 main-is: test/Relation/Export/CSV.hs
331 main-is: test/Relation/Export/CSV.hs
336− Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics,parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, stm-containers, project-m36
337− GHC-Options: -Wall -threaded
338
332
339Test-Suite test-transactiongraph-merge
333Test-Suite test-transactiongraph-merge
340− Default-Language: Haskell2010
334+ import: commontest
341− Default-Extensions: OverloadedStrings
342 type: exitcode-stdio-1.0
335 type: exitcode-stdio-1.0
343 main-is: test/TransactionGraph/Merge.hs
336 main-is: test/TransactionGraph/Merge.hs
344− Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics,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+
345− GHC-Options: -Wall -threaded
346
338
347benchmark bench
339benchmark bench
348− Default-Language: Haskell2010
340+ import: commontest
349− Default-Extensions: OverloadedStrings
350 type: exitcode-stdio-1.0
341 type: exitcode-stdio-1.0
351 main-is: benchmark/Relation.hs
342 main-is: benchmark/Relation.hs
352− Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics,parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, criterion, stm-containers, project-m36
353− GHC-Options: -Wall -rtsopts -threaded
354− Hs-Source-Dirs: ./src/bin
355
343
356Test-Suite test-server
344Test-Suite test-server
357− Default-Language: Haskell2010
345+ import: commontest
358− Default-Extensions: OverloadedStrings
359 type: exitcode-stdio-1.0
346 type: exitcode-stdio-1.0
360 main-is: test/Server/Main.hs
347 main-is: test/Server/Main.hs
361− 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,parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, transformers, stm-containers, list-t, project-m36, network-transport, semigroups
348+
362− HS-Source-Dirs: ., ./src/bin
363− GHC-Options: -Wall -threaded
364
349
365Executable Example-SimpleClient
350Executable Example-SimpleClient
366 Default-Language: Haskell2010
351 Default-Language: Haskell2010
@@ -408,14 +393,10 @@ Executable Example-DerivingCustomTupleable
408 GHC-Options: -Wall -threaded
393 GHC-Options: -Wall -threaded
409
394
410Test-Suite test-scripts
395Test-Suite test-scripts
411− Default-Language: Haskell2010
396+ import: commontest
412− Default-Extensions: OverloadedStrings
413 type: exitcode-stdio-1.0
397 type: exitcode-stdio-1.0
414 main-is: test/scripts.hs
398 main-is: test/scripts.hs
415− 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,parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, transformers, stm-containers, list-t, project-m36, random, MonadRandom, semigroups, parser-combinators
416 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
399 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
417− GHC-Options: -Wall -threaded
418− Hs-Source-Dirs: ., ./src/bin
419
400
420Executable project-m36-websocket-server
401Executable project-m36-websocket-server
421 Default-Language: Haskell2010
402 Default-Language: Haskell2010
@@ -427,70 +408,42 @@ Executable project-m36-websocket-server
427 Default-Extensions: OverloadedStrings
408 Default-Extensions: OverloadedStrings
428
409
429Test-Suite test-websocket-server
410Test-Suite test-websocket-server
430− Default-Language: Haskell2010
411+ import: commontest
431 type: exitcode-stdio-1.0
412 type: exitcode-stdio-1.0
432 main-is: test/Server/WebSocket.hs
413 main-is: test/Server/WebSocket.hs
433− Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics,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, parser-combinators
434 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
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, TutorialD.Interpreter.SchemaOperator
435− Default-Extensions: OverloadedStrings
436− GHC-Options: -Wall -threaded
437− Hs-Source-Dirs: ./src/bin, .
438
415
439Test-Suite test-isomorphic-schemas
416Test-Suite test-isomorphic-schemas
440− Default-Language: Haskell2010
417+ import: commontest
441 type: exitcode-stdio-1.0
418 type: exitcode-stdio-1.0
442 main-is: test/IsomorphicSchema.hs
419 main-is: test/IsomorphicSchema.hs
443− Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics,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
444− Default-Extensions: OverloadedStrings
445− GHC-Options: -Wall -threaded
446− Hs-Source-Dirs: ./src/bin, .
447
420
448Test-Suite test-atomable
421Test-Suite test-atomable
449− Default-Language: Haskell2010
422+ import: commontest
450 type: exitcode-stdio-1.0
423 type: exitcode-stdio-1.0
451 main-is: test/Relation/Atomable.hs
424 main-is: test/Relation/Atomable.hs
452− Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics,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, parser-combinators, winery
453 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
425 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
454− Default-Extensions: OverloadedStrings
455− GHC-Options: -Wall -threaded
456− Hs-Source-Dirs: ./src/bin, ., test/
457
426
458Test-Suite test-multiprocess-access
427Test-Suite test-multiprocess-access
459− Default-Language: Haskell2010
428+ import: commontest
460 type: exitcode-stdio-1.0
429 type: exitcode-stdio-1.0
461 main-is: test/MultiProcessDatabaseAccess.hs
430 main-is: test/MultiProcessDatabaseAccess.hs
462− Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics,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
463− Default-Extensions: OverloadedStrings
464− GHC-Options: -Wall -threaded
465− Hs-Source-Dirs: ./src/bin, ., test/
466
431
467Test-Suite test-transactiongraph-automerge
432Test-Suite test-transactiongraph-automerge
468− Default-Language: Haskell2010
433+ import: commontest
469 type: exitcode-stdio-1.0
434 type: exitcode-stdio-1.0
470 main-is: test/TransactionGraph/Automerge.hs
435 main-is: test/TransactionGraph/Automerge.hs
471− Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics,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, parser-combinators
472 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
436 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
473− Default-Extensions: OverloadedStrings
474− GHC-Options: -Wall -threaded
475− Hs-Source-Dirs: ./src/bin, ., test/
476
437
477Test-Suite test-tupleable
438Test-Suite test-tupleable
478− Default-Language: Haskell2010
439+ import: commontest
479 type: exitcode-stdio-1.0
440 type: exitcode-stdio-1.0
480 main-is: test/Relation/Tupleable.hs
441 main-is: test/Relation/Tupleable.hs
481− Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics,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
482− Default-Extensions: OverloadedStrings
483− GHC-Options: -Wall -threaded
484− Hs-Source-Dirs: ./src/bin, ., test/
485
442
486Test-Suite test-client-simple
443Test-Suite test-client-simple
487− Default-Language: Haskell2010
444+ import: commontest
488 Main-Is: test/Client/Simple.hs
445 Main-Is: test/Client/Simple.hs
489 type: exitcode-stdio-1.0
446 type: exitcode-stdio-1.0
490− Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics,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
491− Default-Extensions: OverloadedStrings
492− GHC-Options: -Wall -threaded
493− Hs-Source-Dirs: ./src/bin, ., test/
494
447
495-- test for file handle leaks
448-- test for file handle leaks
496Executable handles
449Executable handles
src/lib/ProjectM36/Client.hs+5−6
@@ -1,4 +1,4 @@
1−{-# LANGUAGE DeriveAnyClass, DeriveGeneric, ScopedTypeVariables, MonoLocalBinds, DerivingVia, GeneralizedNewtypeDeriving, PackageImports #-}
1+{-# LANGUAGE DeriveGeneric, ScopedTypeVariables, MonoLocalBinds, DerivingVia #-}
2{-|
2{-|
3Module: ProjectM36.Client
3Module: ProjectM36.Client
4
4
@@ -192,7 +192,7 @@ data ConnectionInfo = InProcessConnectionInfo PersistenceStrategy NotificationCa
192type EvaluatedNotifications = M.Map NotificationName EvaluatedNotification
192type EvaluatedNotifications = M.Map NotificationName EvaluatedNotification
193
193
194-- | Used for callbacks from the server when monitored changes have been made.
194-- | Used for callbacks from the server when monitored changes have been made.
195−data NotificationMessage = NotificationMessage EvaluatedNotifications
195+newtype NotificationMessage = NotificationMessage EvaluatedNotifications
196 deriving (Eq, Show, Generic)
196 deriving (Eq, Show, Generic)
197 deriving Serialise via WineryVariant NotificationMessage
197 deriving Serialise via WineryVariant NotificationMessage
198
198
@@ -226,7 +226,7 @@ defaultRemoteConnectionInfo =
226defaultServerHostname :: Hostname
226defaultServerHostname :: Hostname
227defaultServerHostname = "localhost"
227defaultServerHostname = "localhost"
228
228
229−data RemoteConnectionConf = RemoteConnectionConf RPC.Connection
229+newtype RemoteConnectionConf = RemoteConnectionConf RPC.Connection
230
230
231data Connection = InProcessConnection InProcessConnectionConf |
231data Connection = InProcessConnection InProcessConnectionConf |
232 RemoteConnection RemoteConnectionConf
232 RemoteConnection RemoteConnectionConf
@@ -290,8 +290,7 @@ connectProjectM36 (RemoteConnectionInfo dbName hostName servicePort notification
290 notificationHandlers =
290 notificationHandlers =
291 [RPC.ClientAsyncRequestHandler $
291 [RPC.ClientAsyncRequestHandler $
292 \(NotificationMessage notifications') ->
292 \(NotificationMessage notifications') ->
293− forM_ (M.toList notifications') (\(notName, notInfo) ->
293+ forM_ (M.toList notifications') (uncurry notificationCallback)
294− notificationCallback notName notInfo)
295 ]
294 ]
296-- TODO missing async callback
295-- TODO missing async callback
297 conn <- RPC.connect notificationHandlers (hostAddressToTuple addr) port
296 conn <- RPC.connect notificationHandlers (hostAddressToTuple addr) port
@@ -403,7 +402,7 @@ close (InProcessConnection conf) = do
403 Nothing -> pure ()
402 Nothing -> pure ()
404 Just (lockFileH, _) -> closeLockFile lockFileH
403 Just (lockFileH, _) -> closeLockFile lockFileH
405
404
406−close (RemoteConnection (RemoteConnectionConf conn)) = do
405+close (RemoteConnection (RemoteConnectionConf conn)) =
407 RPC.close conn
406 RPC.close conn
408
407
409--used only by the server EntryPoints
408--used only by the server EntryPoints
src/lib/ProjectM36/DataFrame.hs+1−1
@@ -1,4 +1,4 @@
1−{-# LANGUAGE DeriveGeneric, DeriveAnyClass, DerivingVia #-}
1+{-# LANGUAGE DeriveGeneric, DerivingVia #-}
2{- A dataframe is a strongly-typed, ordered list of named tuples. A dataframe differs from a relation in that its tuples are ordered.-}
2{- A dataframe is a strongly-typed, ordered list of named tuples. A dataframe differs from a relation in that its tuples are ordered.-}
3module ProjectM36.DataFrame where
3module ProjectM36.DataFrame where
4import ProjectM36.Base
4import ProjectM36.Base
src/lib/ProjectM36/IsomorphicSchema.hs+1−1
@@ -1,4 +1,4 @@
1−{-# LANGUAGE DeriveGeneric, DeriveAnyClass, LambdaCase, DerivingVia #-}
1+{-# LANGUAGE DeriveGeneric, LambdaCase, DerivingVia #-}
2module ProjectM36.IsomorphicSchema where
2module ProjectM36.IsomorphicSchema where
3import ProjectM36.Base
3import ProjectM36.Base
4import ProjectM36.Error
4import ProjectM36.Error
src/lib/ProjectM36/Serialise/Base.hs+1−1
@@ -1,4 +1,4 @@
1−{-# LANGUAGE StandaloneDeriving, DerivingVia, TypeApplications, TypeSynonymInstances, ScopedTypeVariables, GeneralizedNewtypeDeriving #-}
1+{-# LANGUAGE StandaloneDeriving, DerivingVia, TypeApplications, TypeSynonymInstances, ScopedTypeVariables #-}
2{-# OPTIONS_GHC -fno-warn-orphans #-}
2{-# OPTIONS_GHC -fno-warn-orphans #-}
3--Serialise instances for ProjectM36.Base data types- orphan instance city
3--Serialise instances for ProjectM36.Base data types- orphan instance city
4module ProjectM36.Serialise.Base where
4module ProjectM36.Serialise.Base where
src/lib/ProjectM36/Serialise/IsomorphicSchema.hs+1−1
@@ -1,4 +1,4 @@
1−{-# LANGUAGE StandaloneDeriving, DerivingVia, TypeApplications, TypeSynonymInstances, ScopedTypeVariables, GeneralizedNewtypeDeriving #-}
1+{-# LANGUAGE StandaloneDeriving, DerivingVia, TypeSynonymInstances, ScopedTypeVariables #-}
2{-# OPTIONS_GHC -fno-warn-orphans #-}
2{-# OPTIONS_GHC -fno-warn-orphans #-}
3module ProjectM36.Serialise.IsomorphicSchema where
3module ProjectM36.Serialise.IsomorphicSchema where
4import Codec.Winery
4import Codec.Winery
src/lib/ProjectM36/Server.hs+1−1
@@ -1,4 +1,4 @@
1−{-# LANGUAGE ScopedTypeVariables, TypeApplications #-}
1+{-# LANGUAGE ScopedTypeVariables #-}
2module ProjectM36.Server where
2module ProjectM36.Server where
3
3
4import ProjectM36.Client
4import ProjectM36.Client
src/lib/ProjectM36/Server/EntryPoints.hs+15−17
@@ -13,10 +13,8 @@ import Control.Exception
13timeoutOrDie :: Maybe Timeout -> IO a -> IO (Maybe a)
13timeoutOrDie :: Maybe Timeout -> IO a -> IO (Maybe a)
14timeoutOrDie mMicros act =
14timeoutOrDie mMicros act =
15 case mMicros of
15 case mMicros of
16− Nothing -> do
16+ Nothing -> Just <$> act
17− ret <- act
18− pure (Just ret)
19− Just micros -> do
17+ Just micros ->
20 timeout (fromIntegral micros) act
18 timeout (fromIntegral micros) act
21
19
22timeoutRelErr :: Maybe Timeout -> IO (Either RelationalError a) -> IO (Either RelationalError a)
20timeoutRelErr :: Maybe Timeout -> IO (Either RelationalError a) -> IO (Either RelationalError a)
@@ -53,7 +51,7 @@ handleLogin dbName conn lockSock = do
53 pure True
51 pure True
54
52
55handleExecuteGraphExpr :: Maybe Timeout -> SessionId -> Connection -> TransactionGraphOperator -> IO (Either RelationalError ())
53handleExecuteGraphExpr :: Maybe Timeout -> SessionId -> Connection -> TransactionGraphOperator -> IO (Either RelationalError ())
56−handleExecuteGraphExpr ti sessionId conn graphExpr = do
54+handleExecuteGraphExpr ti sessionId conn graphExpr =
57 timeoutRelErr ti (executeGraphExpr sessionId conn graphExpr)
55 timeoutRelErr ti (executeGraphExpr sessionId conn graphExpr)
58
56
59handleExecuteTransGraphRelationalExpr :: Maybe Timeout -> SessionId -> Connection -> TransGraphRelationalExpr -> IO (Either RelationalError Relation)
57handleExecuteTransGraphRelationalExpr :: Maybe Timeout -> SessionId -> Connection -> TransGraphRelationalExpr -> IO (Either RelationalError Relation)
@@ -65,11 +63,11 @@ handleExecuteTypeForRelationalExpr ti sessionId conn relExpr =
65 timeoutRelErr ti (typeForRelationalExpr sessionId conn relExpr)
63 timeoutRelErr ti (typeForRelationalExpr sessionId conn relExpr)
66
64
67handleRetrieveInclusionDependencies :: Maybe Timeout -> SessionId -> Connection -> IO (Either RelationalError (Map IncDepName InclusionDependency))
65handleRetrieveInclusionDependencies :: Maybe Timeout -> SessionId -> Connection -> IO (Either RelationalError (Map IncDepName InclusionDependency))
68−handleRetrieveInclusionDependencies ti sessionId conn = do
66+handleRetrieveInclusionDependencies ti sessionId conn =
69 timeoutRelErr ti (inclusionDependencies sessionId conn)
67 timeoutRelErr ti (inclusionDependencies sessionId conn)
70
68
71handleRetrievePlanForDatabaseContextExpr :: Maybe Timeout -> SessionId -> Connection -> DatabaseContextExpr -> IO (Either RelationalError GraphRefDatabaseContextExpr)
69handleRetrievePlanForDatabaseContextExpr :: Maybe Timeout -> SessionId -> Connection -> DatabaseContextExpr -> IO (Either RelationalError GraphRefDatabaseContextExpr)
72−handleRetrievePlanForDatabaseContextExpr ti sessionId conn dbExpr = do
70+handleRetrievePlanForDatabaseContextExpr ti sessionId conn dbExpr =
73 timeoutRelErr ti (planForDatabaseContextExpr sessionId conn dbExpr)
71 timeoutRelErr ti (planForDatabaseContextExpr sessionId conn dbExpr)
74
72
75handleRetrieveTransactionGraph :: Maybe Timeout -> SessionId -> Connection -> IO (Either RelationalError Relation)
73handleRetrieveTransactionGraph :: Maybe Timeout -> SessionId -> Connection -> IO (Either RelationalError Relation)
@@ -89,16 +87,16 @@ handleCreateSessionAtHead ti conn headn =
89 timeoutRelErr ti (createSessionAtHead conn headn)
87 timeoutRelErr ti (createSessionAtHead conn headn)
90
88
91handleCloseSession :: SessionId -> Connection -> IO ()
89handleCloseSession :: SessionId -> Connection -> IO ()
92−handleCloseSession sessionId conn =
90+handleCloseSession =
93− closeSession sessionId conn
91+ closeSession
94
92
95handleRetrieveAtomTypesAsRelation :: Maybe Timeout -> SessionId -> Connection -> IO (Either RelationalError Relation)
93handleRetrieveAtomTypesAsRelation :: Maybe Timeout -> SessionId -> Connection -> IO (Either RelationalError Relation)
96−handleRetrieveAtomTypesAsRelation ti sessionId conn = do
94+handleRetrieveAtomTypesAsRelation ti sessionId conn =
97 timeoutRelErr ti (atomTypesAsRelation sessionId conn)
95 timeoutRelErr ti (atomTypesAsRelation sessionId conn)
98
96
99-- | Returns a relation which lists the names of relvars in the current session as well as its types.
97-- | Returns a relation which lists the names of relvars in the current session as well as its types.
100handleRetrieveRelationVariableSummary :: Maybe Timeout -> SessionId -> Connection -> IO (Either RelationalError Relation)
98handleRetrieveRelationVariableSummary :: Maybe Timeout -> SessionId -> Connection -> IO (Either RelationalError Relation)
101−handleRetrieveRelationVariableSummary ti sessionId conn = do
99+handleRetrieveRelationVariableSummary ti sessionId conn =
102 timeoutRelErr ti (relationVariablesAsRelation sessionId conn)
100 timeoutRelErr ti (relationVariablesAsRelation sessionId conn)
103
101
104handleRetrieveAtomFunctionSummary :: Maybe Timeout -> SessionId -> Connection -> IO (Either RelationalError Relation)
102handleRetrieveAtomFunctionSummary :: Maybe Timeout -> SessionId -> Connection -> IO (Either RelationalError Relation)
@@ -110,11 +108,11 @@ handleRetrieveDatabaseContextFunctionSummary ti sessionId conn =
110 timeoutRelErr ti (databaseContextFunctionsAsRelation sessionId conn)
108 timeoutRelErr ti (databaseContextFunctionsAsRelation sessionId conn)
111
109
112handleRetrieveCurrentSchemaName :: Maybe Timeout -> SessionId -> Connection -> IO (Either RelationalError SchemaName)
110handleRetrieveCurrentSchemaName :: Maybe Timeout -> SessionId -> Connection -> IO (Either RelationalError SchemaName)
113−handleRetrieveCurrentSchemaName ti sessionId conn = do
111+handleRetrieveCurrentSchemaName ti sessionId conn =
114 timeoutRelErr ti (currentSchemaName sessionId conn)
112 timeoutRelErr ti (currentSchemaName sessionId conn)
115
113
116handleExecuteSchemaExpr :: Maybe Timeout -> SessionId -> Connection -> SchemaExpr -> IO (Either RelationalError ())
114handleExecuteSchemaExpr :: Maybe Timeout -> SessionId -> Connection -> SchemaExpr -> IO (Either RelationalError ())
117−handleExecuteSchemaExpr ti sessionId conn schemaExpr = do
115+handleExecuteSchemaExpr ti sessionId conn schemaExpr =
118 timeoutRelErr ti (executeSchemaExpr sessionId conn schemaExpr)
116 timeoutRelErr ti (executeSchemaExpr sessionId conn schemaExpr)
119
117
120handleLogout :: Maybe Timeout -> Connection -> IO Bool
118handleLogout :: Maybe Timeout -> Connection -> IO Bool
@@ -128,17 +126,17 @@ handleTestTimeout ti _ _ = do
128 pure True
126 pure True
129
127
130handleRetrieveSessionIsDirty :: Maybe Timeout -> SessionId -> Connection -> IO (Either RelationalError Bool)
128handleRetrieveSessionIsDirty :: Maybe Timeout -> SessionId -> Connection -> IO (Either RelationalError Bool)
131−handleRetrieveSessionIsDirty ti sessionId conn = do
129+handleRetrieveSessionIsDirty ti sessionId conn =
132 timeoutRelErr ti (disconnectedTransactionIsDirty sessionId conn)
130 timeoutRelErr ti (disconnectedTransactionIsDirty sessionId conn)
133
131
134handleExecuteAutoMergeToHead :: Maybe Timeout -> SessionId -> Connection -> MergeStrategy -> HeadName -> IO (Either RelationalError ())
132handleExecuteAutoMergeToHead :: Maybe Timeout -> SessionId -> Connection -> MergeStrategy -> HeadName -> IO (Either RelationalError ())
135−handleExecuteAutoMergeToHead ti sessionId conn strat headName' = do
133+handleExecuteAutoMergeToHead ti sessionId conn strat headName' =
136 timeoutRelErr ti (autoMergeToHead sessionId conn strat headName')
134 timeoutRelErr ti (autoMergeToHead sessionId conn strat headName')
137
135
138handleRetrieveTypeConstructorMapping :: Maybe Timeout -> SessionId -> Connection -> IO (Either RelationalError TypeConstructorMapping)
136handleRetrieveTypeConstructorMapping :: Maybe Timeout -> SessionId -> Connection -> IO (Either RelationalError TypeConstructorMapping)
139−handleRetrieveTypeConstructorMapping ti sessionId conn = do
137+handleRetrieveTypeConstructorMapping ti sessionId conn =
140 timeoutRelErr ti (C.typeConstructorMapping sessionId conn)
138 timeoutRelErr ti (C.typeConstructorMapping sessionId conn)
141
139
142handleValidateMerkleHashes :: Maybe Timeout -> SessionId -> Connection -> IO (Either RelationalError ())
140handleValidateMerkleHashes :: Maybe Timeout -> SessionId -> Connection -> IO (Either RelationalError ())
143−handleValidateMerkleHashes ti sessionId conn = do
141+handleValidateMerkleHashes ti sessionId conn =
144 timeoutRelErr ti (C.validateMerkleHashes sessionId conn)
142 timeoutRelErr ti (C.validateMerkleHashes sessionId conn)
src/lib/ProjectM36/Server/RemoteCallTypes.hs+1−1
@@ -1,4 +1,4 @@
1−{-# LANGUAGE DeriveAnyClass, DeriveGeneric, DerivingVia, DerivingStrategies, DeriveGeneric, CPP #-}
1+{-# LANGUAGE DeriveGeneric, DerivingVia, CPP #-}
2module ProjectM36.Server.RemoteCallTypes where
2module ProjectM36.Server.RemoteCallTypes where
3import ProjectM36.Base
3import ProjectM36.Base
4import ProjectM36.IsomorphicSchema
4import ProjectM36.IsomorphicSchema
src/lib/ProjectM36/TransactionGraph.hs+1−1
@@ -1,4 +1,4 @@
1−{-# LANGUAGE DeriveAnyClass, DeriveGeneric, CPP, FlexibleContexts, DerivingVia #-}
1+{-# LANGUAGE DeriveGeneric, CPP, FlexibleContexts, DerivingVia #-}
2module ProjectM36.TransactionGraph where
2module ProjectM36.TransactionGraph where
3import ProjectM36.Base
3import ProjectM36.Base
4import ProjectM36.Error
4import ProjectM36.Error