diff --git a/libs/Haskell/nixpkgs.json b/libs/Haskell/nixpkgs.json new file mode 100644 index 0000000..bc5366f --- /dev/null +++ b/libs/Haskell/nixpkgs.json @@ -0,0 +1,7 @@ +{ + "url": "https://github.com/NixOS/nixpkgs.git", + "rev": "ea0820818a7bfd9086d021122c6e23f24d166be7", + "date": "2019-02-17T15:23:14+00:00", + "sha256": "1mcxdzjnxmch7225shn104c33vdg0swray8g1pg4w2bs9i0q6n03", + "fetchSubmodules": false +} diff --git a/libs/Haskell/records-haystack/aesd-records-haystack.cabal b/libs/Haskell/records-haystack/aesd-records-haystack.cabal index 7715d24..f4ad90b 100644 --- a/libs/Haskell/records-haystack/aesd-records-haystack.cabal +++ b/libs/Haskell/records-haystack/aesd-records-haystack.cabal @@ -1,5 +1,5 @@ name : aesd-records-haystack -version : 0.4.1.3 +version : 0.5.0.0 synopsis : Haystack support for AESD records API. description : Haystack support for AESD records API. @@ -7,7 +7,7 @@ license : MIT license-file : LICENSE author : Brian W Bush maintainer : Brian W Bush -copyright : (c) 2016-18 Alliance for Sustainable Energy +copyright : (c) 2016-19 Alliance for Sustainable Energy category : Network build-type : Simple cabal-version: >= 1.10 @@ -28,7 +28,7 @@ library exposed-modules : AESD.Haystack AESD.Haystack.Cache.Memory NREL.Meters - build-depends : base >=4.8 && <4.9 + build-depends : base >= 4.8 && < 5 , aeson , bytestring , aesd-records @@ -51,6 +51,9 @@ library executable aesd-haystack-server hs-source-dirs : src main-is : Main.hs + other-modules : AESD.Haystack + AESD.Haystack.Cache.Memory + NREL.Meters build-depends : base , aeson , bytestring diff --git a/libs/Haskell/records-haystack/aesd-records-haystack.config b/libs/Haskell/records-haystack/aesd-records-haystack.config index 552ea4a..da5ed05 100644 --- a/libs/Haskell/records-haystack/aesd-records-haystack.config +++ b/libs/Haskell/records-haystack/aesd-records-haystack.config @@ -1,131 +1,124 @@ -constraints: SHA ==1.6.4.2, - StateVar ==1.1.0.4, - adjunctions ==4.3, - aesd-records ==0.4.4.4, - aeson ==1.1.2.0, - array ==0.5.1.0, +constraints: SHA ==1.6.4.4, + StateVar ==1.1.1.1, + adjunctions ==4.4, + aesd-records ==0.5.0.0, + aeson ==1.3.1.1, + array ==0.5.2.0, asn1-encoding ==0.9.5, asn1-parse ==0.9.4, asn1-types ==0.3.2, - async ==2.1.1.1, - attoparsec ==0.13.1.0, - base ==4.8.2.0, - base-compat ==0.9.3, - base-orphans ==0.6, + async ==2.2.1, + attoparsec ==0.13.2.2, + base ==4.10.1.0, + base-compat ==0.10.4, + base-orphans ==0.7, base64-bytestring ==1.0.0.1, - bifunctors ==5.4.2, - binary ==0.7.5.0, - blaze-builder ==0.4.0.2, + basement ==0.0.8, + bifunctors ==5.5.3, + binary ==0.8.5.1, + blaze-builder ==0.4.1.0, byteable ==0.1.1, - bytestring ==0.10.6.0, + bytestring ==0.10.8.2, + bytestring-builder ==0.10.8.1.0, call-stack ==0.1.0, - case-insensitive ==1.2.0.10, - cereal ==0.5.4.0, - comonad ==5.0.2, - conduit ==1.2.11, - conduit-extra ==1.1.16, + case-insensitive ==1.2.0.11, + cereal ==0.5.7.0, + comonad ==5.0.4, + conduit ==1.3.0.3, + conduit-extra ==1.3.0, connection ==0.2.8, - containers ==0.5.6.2, - contravariant ==1.4, - cookie ==0.4.2.1, + containers ==0.5.10.2, + contravariant ==1.4.1, + cookie ==0.4.4, cryptohash-md5 ==0.11.100.1, cryptohash-sha1 ==0.11.100.1, - cryptonite ==0.23, - daft ==0.4.14.6, + cryptonite ==0.25, + daft ==0.5.0.0, data-binary-ieee754 ==0.4.4, data-default ==0.7.1.1, data-default-class ==0.1.2.0, data-default-instances-containers ==0.0.1, data-default-instances-dlist ==0.0.1, data-default-instances-old-locale ==0.0.1, - deepseq ==1.4.1.1, - directory ==1.2.2.0, + deepseq ==1.4.3.0, + directory ==1.3.0.2, distributive ==0.5.3, - dlist ==0.8.0.3, - entropy ==0.3.8, - exceptions ==0.8.3, - fail ==4.9.0.0, - filepath ==1.4.0.0, - foundation ==0.0.13, - free ==4.12.4, - generic-deriving ==1.11.2, - ghc-prim ==0.4.0.0, - hashable ==1.2.6.1, - hourglass ==0.2.10, - http-client ==0.5.7.0, - http-client-tls ==0.3.5.1, - http-conduit ==2.2.3.2, - http-types ==0.9.1, - integer-gmp ==1.0.0.0, - integer-logarithms ==1.0.2, - kan-extensions ==5.0.2, - lens ==4.15.4, - lifted-base ==0.2.3.11, - memory ==0.14.6, - mime-types ==0.1.0.7, - mmorph ==1.0.9, - monad-control ==1.0.2.2, - mtl ==2.2.1, - network ==2.6.3.2, - network-info ==0.2.0.8, + dlist ==0.8.0.4, + entropy ==0.4.1.1, + exceptions ==0.10.0, + filepath ==1.4.1.2, + foundation ==0.0.21, + free ==5.0.2, + ghc-boot-th ==8.2.2, + ghc-prim ==0.5.1.1, + hashable ==1.2.7.0, + hourglass ==0.2.12, + http-client ==0.5.13.1, + http-client-tls ==0.3.5.3, + http-conduit ==2.3.2, + http-types ==0.12.1, + integer-gmp ==1.0.1.0, + integer-logarithms ==1.0.2.1, + invariant ==0.5.1, + kan-extensions ==5.2, + lens ==4.16.1, + memory ==0.14.16, + mime-types ==0.1.0.8, + mono-traversable ==1.0.9.0, + mtl ==2.2.2, + network ==2.6.3.6, + network-info ==0.2.0.10, network-uri ==2.6.1.0, old-locale ==1.0.0.7, - parallel ==3.2.1.1, - parsec ==3.1.11, - pem ==0.2.2, - prelude-extras ==0.4.0.3, - pretty ==1.1.2.0, - primitive ==0.6.2.0, - process ==1.2.3.0, - profunctors ==5.2.1, - protobuf ==0.2.1.1, - raft ==0.3.11.1, + parallel ==3.2.2.0, + parsec ==3.1.13.0, + pem ==0.2.4, + pretty ==1.1.3.3, + primitive ==0.6.3.0, + process ==1.6.1.0, + profunctors ==5.2.2, + protobuf ==0.2.1.2, + raft ==0.4.0.0, random ==1.1, - reflection ==2.1.2, + reflection ==2.1.4, regex-base ==0.93.2, regex-posix ==0.95.2, - resourcet ==1.1.9, + resourcet ==1.2.1, rts ==1.0, - safe ==0.3.15, - scientific ==0.3.5.2, - semigroupoids ==5.2.1, - semigroups ==0.18.3, - singletons ==2.1, - socks ==0.5.5, - split ==0.2.3.2, - stm ==2.4.4.1, - streaming-commons ==0.1.17, - syb ==0.7, + scientific ==0.3.6.2, + semigroupoids ==5.2.2, + semigroups ==0.18.5, + socks ==0.5.6, + split ==0.2.3.3, + stm ==2.4.5.1, + streaming-commons ==0.2.1.0, tagged ==0.8.5, - template-haskell ==2.10.0.0, - text ==1.2.2.2, - th-abstraction ==0.2.5.0, - th-desugar ==1.6, - th-expand-syns ==0.4.3.0, - th-lift ==0.7.7, - th-lift-instances ==0.1.11, - th-orphans ==0.13.4, - th-reify-many ==0.1.8, - time ==1.5.0.1, - time-locale-compat ==0.1.1.3, - tls ==1.3.11, + template-haskell ==2.12.0.0, + text ==1.2.3.0, + th-abstraction ==0.2.8.0, + time ==1.8.0.2, + time-locale-compat ==0.1.1.5, + tls ==1.4.1, tostring ==0.2.1.1, - transformers ==0.4.2.0, - transformers-base ==0.4.4, - transformers-compat ==0.5.1.4, + transformers ==0.5.2.0, + transformers-base ==0.4.5.2, + transformers-compat ==0.6.2, type-list ==0.5.0.0, - unix ==2.7.1.0, - unordered-containers ==0.2.8.0, + typed-process ==0.2.3.0, + unix ==2.7.2.2, + unliftio-core ==0.1.2.0, + unordered-containers ==0.2.9.0, utf8-string ==1.0.1.1, uuid ==1.3.13, uuid-types ==1.0.3, vector ==0.12.0.1, - vinyl ==0.5.3, + vector-algorithms ==0.7.0.4, + vinyl ==0.5.2, void ==0.7.2, - websockets ==0.10.0.0, - x509 ==1.7.2, - x509-store ==1.6.5, + websockets ==0.12.5.1, + x509 ==1.7.3, + x509-store ==1.6.6, x509-system ==1.6.6, - x509-validation ==1.6.9, - yaml ==0.8.23.3, - zlib ==0.6.1.2 + x509-validation ==1.6.10, + yaml ==0.8.32, + zlib ==0.6.2 diff --git a/libs/Haskell/records-haystack/default.nix b/libs/Haskell/records-haystack/default.nix index a98a403..787c2da 100644 --- a/libs/Haskell/records-haystack/default.nix +++ b/libs/Haskell/records-haystack/default.nix @@ -1,24 +1,20 @@ -{ mkDerivation, aeson, base, bytestring, aesd-records, daft -, data-default, http-conduit, lens, mtl, network-uri, raft -, resourcet, stdenv, text, time, unordered-containers, vinyl, yaml +{ + mkDerivation, stdenv +, aeson, base, bytestring, aesd-records, daft, data-default, http-conduit, lens, mtl, network-uri, raft, resourcet, text, time, unordered-containers, vinyl, yaml }: mkDerivation { pname = "aesd-records-haystack"; - version = "0.4.1.3"; + version = "0.5.0.0"; src = ./.; isLibrary = true; isExecutable = true; libraryHaskellDepends = [ - aeson base bytestring aesd-records daft data-default http-conduit - lens mtl network-uri raft resourcet text time unordered-containers - vinyl yaml + aeson base bytestring aesd-records daft data-default http-conduit lens mtl network-uri raft resourcet text time unordered-containers vinyl yaml ]; executableHaskellDepends = [ - aeson base bytestring aesd-records daft data-default http-conduit - lens mtl network-uri raft resourcet text time unordered-containers - vinyl yaml + aeson base bytestring aesd-records daft data-default http-conduit lens mtl network-uri raft resourcet text time unordered-containers vinyl yaml ]; - homepage = "https://github.com/NREL/AESD/libs/Haskell/records-haystack"; + homepage = "https://github.com/NREL/AESD/libs/Haskell/records-haystack/ReadMe.md"; description = "Haystack support for AESD records API"; license = stdenv.lib.licenses.mit; } diff --git a/libs/Haskell/records-haystack/release.nix b/libs/Haskell/records-haystack/release.nix index ca44520..e21693f 100644 --- a/libs/Haskell/records-haystack/release.nix +++ b/libs/Haskell/records-haystack/release.nix @@ -1,16 +1,22 @@ -{ compiler ? "ghc7103" }: +{ + nixpkgs ? import +, compiler ? "ghc822" +}: let config = { + allowUnfree = true; packageOverrides = pkgs: rec { haskell = pkgs.haskell // { packages = pkgs.haskell.packages // { "${compiler}" = pkgs.haskell.packages."${compiler}".override { overrides = haskellPackagesNew: haskellPackagesOld: rec { - aesd-records-haystack = - haskellPackagesNew.callPackage ./default.nix { }; - aesd-records = - haskellPackagesNew.callPackage ../records/default.nix { }; + aesd-records-haystack = haskellPackagesNew.callPackage ./default.nix { }; + aesd-records = haskellPackagesNew.callPackage ../records/default.nix { }; + raft = haskellPackagesNew.callPackage ../../../../raft/default.nix { }; + daft = haskellPackagesNew.callPackage ../../../../daft-public/daft/default.nix { }; + vinyl = haskellPackagesNew.callPackage ../../../../daft-public/daft/vinyl.nix { }; + type-list = haskellPackagesNew.callPackage ../../../../daft-public/daft/type-list.nix { }; }; }; }; diff --git a/libs/Haskell/records-haystack/shell.nix b/libs/Haskell/records-haystack/shell.nix index a2d0f1b..1130e66 100644 --- a/libs/Haskell/records-haystack/shell.nix +++ b/libs/Haskell/records-haystack/shell.nix @@ -1 +1,44 @@ -((import ./release.nix) {}).aesd-records-haystack.env +{ + nixpkgs ? import +, compiler ? "ghc822" +}: + +let + + nixpkgs1 = + if nixpkgs == null + then let + bootstrap = import { }; + location = builtins.fromJSON (builtins.readFile ../nixpkgs.json); + src = bootstrap.fetchFromGitHub { + owner = "NixOS"; + repo = "nixpkgs"; + inherit (location) rev sha256; + }; + in + import src + else nixpkgs; + + pkgs = nixpkgs1 { }; + + release = (import ./release.nix) {nixpkgs = nixpkgs1; compiler = compiler;}; + + aesd-records-haystack = release.aesd-records-haystack; + + haskellPackages = pkgs.haskell.packages."${compiler}"; + +in + + pkgs.lib.overrideDerivation aesd-records-haystack.env (old: { + buildInputs = old.buildInputs ++ [ + haskellPackages.cabal-install + # haskellPackages.ghc-mod + haskellPackages.ghcid + # haskellPackages.hasktags + haskellPackages.hdevtools + haskellPackages.hindent + haskellPackages.hlint + haskellPackages.pointfree + haskellPackages.pointful + ]; + }) diff --git a/libs/Haskell/records-haystack/src/AESD/Haystack.hs b/libs/Haskell/records-haystack/src/AESD/Haystack.hs index 18407b4..22ae049 100644 --- a/libs/Haskell/records-haystack/src/AESD/Haystack.hs +++ b/libs/Haskell/records-haystack/src/AESD/Haystack.hs @@ -1,6 +1,6 @@ {-| Module : $Header$ -Copyright : (c) 2016-18 Alliance for Sustainable Energy LLC +Copyright : (c) 2016-19 Alliance for Sustainable Energy LLC License : MIT Maintainer : Brian W Bush Stability : Stable diff --git a/libs/Haskell/records-haystack/src/AESD/Haystack/Cache/Memory.hs b/libs/Haskell/records-haystack/src/AESD/Haystack/Cache/Memory.hs index dfae92c..d0a63dc 100644 --- a/libs/Haskell/records-haystack/src/AESD/Haystack/Cache/Memory.hs +++ b/libs/Haskell/records-haystack/src/AESD/Haystack/Cache/Memory.hs @@ -1,6 +1,6 @@ {-| Module : $Header$ -Copyright : (c) 2016-18 Alliance for Sustainable Energy LLC +Copyright : (c) 2016-19 Alliance for Sustainable Energy LLC License : MIT Maintainer : Brian W Bush Stability : Stable @@ -14,7 +14,6 @@ A memory cache for data from Haystack. {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} -{-# LANGUAGE TupleSections #-} module AESD.Haystack.Cache.Memory ( diff --git a/libs/Haskell/records-haystack/src/Main.hs b/libs/Haskell/records-haystack/src/Main.hs index e221cc6..38862bb 100644 --- a/libs/Haskell/records-haystack/src/Main.hs +++ b/libs/Haskell/records-haystack/src/Main.hs @@ -1,6 +1,6 @@ {-| Module : $Header$ -Copyright : (c) 2016-18 Alliance for Sustainable Energy LLC +Copyright : (c) 2016-19 Alliance for Sustainable Energy LLC License : MIT Maintainer : Brian W Bush Stability : Stable @@ -26,7 +26,7 @@ import Control.Monad.Except (liftIO) import Control.Monad.Except.Util (runToIO) import Control.Monad.Trans.Resource (runResourceT) import Data.Text (pack) -import Data.Yaml (decodeFile) +import Data.Yaml (decodeFileEither) import NREL.Meters (Site(..), meters, siteModels) import Network.HTTP.Conduit (newManager, tlsManagerSettings) import System.Environment (getArgs) @@ -36,7 +36,7 @@ main :: IO () main = do [configuration, host, port, start, persistence, chunkSize] <- getArgs -- FIXME - Just site <- decodeFile configuration + Right site <- decodeFileEither configuration let access = siteAccess site runResourceT diff --git a/libs/Haskell/records-haystack/src/NREL/Meters.hs b/libs/Haskell/records-haystack/src/NREL/Meters.hs index aa9b8dd..98844d7 100644 --- a/libs/Haskell/records-haystack/src/NREL/Meters.hs +++ b/libs/Haskell/records-haystack/src/NREL/Meters.hs @@ -1,6 +1,6 @@ {-| Module : $Header$ -Copyright : (c) 2016-18 Alliance for Sustainable Energy LLC +Copyright : (c) 2016-19 Alliance for Sustainable Energy LLC License : MIT Maintainer : Brian W Bush Stability : Stable diff --git a/libs/Haskell/records-hdbc/aesd-records-hdbc.cabal b/libs/Haskell/records-hdbc/aesd-records-hdbc.cabal index 454c2c1..6d3f030 100644 --- a/libs/Haskell/records-hdbc/aesd-records-hdbc.cabal +++ b/libs/Haskell/records-hdbc/aesd-records-hdbc.cabal @@ -1,5 +1,5 @@ name : aesd-records-hdbc -version : 0.4.1.3 +version : 0.5.0.0 synopsis : Database support for AESD records API. description : The package provides HDBC support for PostgreSQL, SQLite3, MySQL, and ODBC support for the AESD records API. @@ -51,7 +51,7 @@ license : MIT license-file : LICENSE author : Brian W Bush maintainer : Brian W Bush -copyright : (c) 2017 Alliance for Sustainable Energy LLC +copyright : (c) 2017-19 Alliance for Sustainable Energy LLC category : Network build-type : Simple cabal-version: >= 1.10 @@ -86,7 +86,7 @@ flag ODBC library hs-source-dirs : src exposed-modules : AESD.Records.Server.HDBC - build-depends : base >=4.8 && <4.9 + build-depends : base >=4 && <5 , aesd-records , data-default , directory @@ -99,6 +99,7 @@ library executable aesd-postgresql-server hs-source-dirs : src main-is : MainPostgreSQL.hs + other-modules : AESD.Records.Server.HDBC build-depends : base , aeson , aesd-records @@ -119,6 +120,7 @@ executable aesd-postgresql-server executable aesd-sqlite3-server hs-source-dirs : src main-is : MainSQLite3.hs + other-modules : AESD.Records.Server.HDBC build-depends : base , aeson , aesd-records @@ -139,6 +141,7 @@ executable aesd-sqlite3-server executable aesd-mysql-server hs-source-dirs : src main-is : MainMySQL.hs + other-modules : AESD.Records.Server.HDBC build-depends : base , aeson , aesd-records @@ -151,6 +154,7 @@ executable aesd-mysql-server , yaml if flag(MySQL) buildable : True + build-depends : HDBC-mysql else buildable : False default-language: Haskell2010 @@ -159,6 +163,7 @@ executable aesd-mysql-server executable aesd-odbc-server hs-source-dirs : src main-is : MainODBC.hs + other-modules : AESD.Records.Server.HDBC build-depends : base , aeson , aesd-records diff --git a/libs/Haskell/records-hdbc/aesd-records-hdbc.config b/libs/Haskell/records-hdbc/aesd-records-hdbc.config index 49cfd62..c9a2979 100644 --- a/libs/Haskell/records-hdbc/aesd-records-hdbc.config +++ b/libs/Haskell/records-hdbc/aesd-records-hdbc.config @@ -1,28 +1,29 @@ constraints: HDBC ==2.4.0.2, HDBC-postgresql ==2.3.2.5, HDBC-sqlite3 ==2.3.3.1, - SHA ==1.6.4.2, - StateVar ==1.1.0.4, - adjunctions ==4.3, - aesd-records ==0.4.4.4, - aeson ==1.1.2.0, - array ==0.5.1.0, - attoparsec ==0.13.1.0, - base ==4.8.2.0, - base-compat ==0.9.3, - base-orphans ==0.6, + SHA ==1.6.4.4, + StateVar ==1.1.1.1, + adjunctions ==4.4, + aesd-records ==0.5.0.0, + aeson ==1.3.1.1, + array ==0.5.2.0, + async ==2.2.1, + attoparsec ==0.13.2.2, + base ==4.10.1.0, + base-compat ==0.10.4, + base-orphans ==0.7, base64-bytestring ==1.0.0.1, - bifunctors ==5.4.2, - binary ==0.7.5.0, - blaze-builder ==0.4.0.2, - bytestring ==0.10.6.0, + bifunctors ==5.5.3, + binary ==0.8.5.1, + bytestring ==0.10.8.2, + bytestring-builder ==0.10.8.1.0, call-stack ==0.1.0, - case-insensitive ==1.2.0.10, - cereal ==0.5.4.0, - comonad ==5.0.2, - conduit ==1.2.11, - containers ==0.5.6.2, - contravariant ==1.4, + case-insensitive ==1.2.0.11, + cereal ==0.5.7.0, + comonad ==5.0.4, + conduit ==1.3.0.3, + containers ==0.5.10.2, + contravariant ==1.4.1, convertible ==1.1.1.0, cryptohash-md5 ==0.11.100.1, cryptohash-sha1 ==0.11.100.1, @@ -32,66 +33,67 @@ constraints: HDBC ==2.4.0.2, data-default-instances-containers ==0.0.1, data-default-instances-dlist ==0.0.1, data-default-instances-old-locale ==0.0.1, - deepseq ==1.4.1.1, - directory ==1.2.2.0, + deepseq ==1.4.3.0, + directory ==1.3.0.2, distributive ==0.5.3, - dlist ==0.8.0.3, - entropy ==0.3.8, - exceptions ==0.8.3, - fail ==4.9.0.0, - filepath ==1.4.0.0, - free ==4.12.4, - generic-deriving ==1.11.2, - ghc-prim ==0.4.0.0, - hashable ==1.2.6.1, - integer-gmp ==1.0.0.0, - integer-logarithms ==1.0.2, - kan-extensions ==5.0.2, - lens ==4.15.4, - lifted-base ==0.2.3.11, - mmorph ==1.0.9, - monad-control ==1.0.2.2, - mtl ==2.2.1, - network ==2.6.3.2, - network-info ==0.2.0.8, + dlist ==0.8.0.4, + entropy ==0.4.1.1, + exceptions ==0.10.0, + filepath ==1.4.1.2, + free ==5.0.2, + ghc-boot-th ==8.2.2, + ghc-prim ==0.5.1.1, + hashable ==1.2.7.0, + integer-gmp ==1.0.1.0, + integer-logarithms ==1.0.2.1, + invariant ==0.5.1, + kan-extensions ==5.2, + lens ==4.16.1, + mono-traversable ==1.0.9.0, + mtl ==2.2.2, + network ==2.6.3.6, + network-info ==0.2.0.10, old-locale ==1.0.0.7, old-time ==1.1.0.3, - parallel ==3.2.1.1, - parsec ==3.1.11, - prelude-extras ==0.4.0.3, - pretty ==1.1.2.0, - primitive ==0.6.2.0, - profunctors ==5.2.1, - protobuf ==0.2.1.1, - raft ==0.3.11.1, + parallel ==3.2.2.0, + parsec ==3.1.13.0, + pretty ==1.1.3.3, + primitive ==0.6.3.0, + process ==1.6.1.0, + profunctors ==5.2.2, + protobuf ==0.2.1.2, + raft ==0.4.0.0, random ==1.1, - reflection ==2.1.2, + reflection ==2.1.4, regex-base ==0.93.2, regex-posix ==0.95.2, - resourcet ==1.1.9, + resourcet ==1.2.1, rts ==1.0, - scientific ==0.3.5.2, - semigroupoids ==5.2.1, - semigroups ==0.18.3, - split ==0.2.3.2, - stm ==2.4.4.1, + scientific ==0.3.6.2, + semigroupoids ==5.2.2, + semigroups ==0.18.5, + split ==0.2.3.3, + stm ==2.4.5.1, + streaming-commons ==0.2.1.0, tagged ==0.8.5, - template-haskell ==2.10.0.0, - text ==1.2.2.2, - th-abstraction ==0.2.5.0, - time ==1.5.0.1, - time-locale-compat ==0.1.1.3, + template-haskell ==2.12.0.0, + text ==1.2.3.0, + th-abstraction ==0.2.8.0, + time ==1.8.0.2, + time-locale-compat ==0.1.1.5, tostring ==0.2.1.1, - transformers ==0.4.2.0, - transformers-base ==0.4.4, - transformers-compat ==0.5.1.4, - unix ==2.7.1.0, - unordered-containers ==0.2.8.0, + transformers ==0.5.2.0, + transformers-base ==0.4.5.2, + transformers-compat ==0.6.2, + unix ==2.7.2.2, + unliftio-core ==0.1.2.0, + unordered-containers ==0.2.9.0, utf8-string ==1.0.1.1, uuid ==1.3.13, uuid-types ==1.0.3, vector ==0.12.0.1, + vector-algorithms ==0.7.0.4, void ==0.7.2, - websockets ==0.10.0.0, - yaml ==0.8.23.3, - zlib ==0.6.1.2 + websockets ==0.12.5.1, + yaml ==0.8.32, + zlib ==0.6.2 diff --git a/libs/Haskell/records-hdbc/default.nix b/libs/Haskell/records-hdbc/default.nix index 9d4d104..6b2b5c7 100644 --- a/libs/Haskell/records-hdbc/default.nix +++ b/libs/Haskell/records-hdbc/default.nix @@ -1,10 +1,14 @@ -{ mkDerivation, aeson, base, aesd-records, data-default, directory -, filepath, HDBC, HDBC-mysql, HDBC-odbc, HDBC-postgresql -, HDBC-sqlite3, stdenv, uuid, yaml +{ + mkDerivation, stdenv +, aeson, base, aesd-records, data-default, directory, filepath, HDBC, HDBC-mysql, HDBC-odbc, HDBC-postgresql, HDBC-sqlite3, uuid, yaml +, useMySQL ? false +, useODBC ? false +, usePostgreSQL ? true +, useSQLite3 ? true }: mkDerivation { pname = "aesd-records-hdbc"; - version = "0.4.1.3"; + version = "0.5.0.0"; src = ./.; isLibrary = true; isExecutable = true; @@ -12,10 +16,20 @@ mkDerivation { base aesd-records data-default directory filepath HDBC uuid ]; executableHaskellDepends = [ - aeson base aesd-records data-default directory filepath HDBC - HDBC-mysql HDBC-odbc HDBC-postgresql HDBC-sqlite3 uuid yaml - ]; - homepage = "https://github.com/NREL/AESD/libs/Haskell/records-hdbc"; + aeson base aesd-records data-default directory filepath HDBC uuid yaml + ] + ++ (if useMySQL then [HDBC-mysql ] else []) + ++ (if useODBC then [HDBC-odbc ] else []) + ++ (if usePostgreSQL then [HDBC-postgresql] else []) + ++ (if useSQLite3 then [HDBC-sqlite3 ] else []) + ; + configureFlags = [] + ++ (if useMySQL then ["-f MySQL=True" ] else ["-f MySQL=False" ]) + ++ (if useODBC then ["-f ODBC=True" ] else ["-f ODBC=False" ]) + ++ (if usePostgreSQL then ["-f PostgreSQL=True"] else ["-f PostgreSQL=False"]) + ++ (if useSQLite3 then ["-f SQLite3=True" ] else ["-f SQLite3=False" ]) + ; + homepage = "https://github.com/NREL/AESD/libs/Haskell/records-hdbc/ReadMe.md"; description = "Database support for AESD records API"; license = stdenv.lib.licenses.mit; } diff --git a/libs/Haskell/records-hdbc/release.nix b/libs/Haskell/records-hdbc/release.nix index 49e6484..25d595f 100644 --- a/libs/Haskell/records-hdbc/release.nix +++ b/libs/Haskell/records-hdbc/release.nix @@ -1,4 +1,7 @@ -{ compiler ? "ghc7103" }: +{ + nixpkgs ? import +, compiler ? "ghc822" +}: let config = { @@ -7,10 +10,9 @@ let packages = pkgs.haskell.packages // { "${compiler}" = pkgs.haskell.packages."${compiler}".override { overrides = haskellPackagesNew: haskellPackagesOld: rec { - aesd-records-hdbc = - haskellPackagesNew.callPackage ./default.nix { }; - aesd-records = - haskellPackagesNew.callPackage ../records/default.nix { }; + aesd-records-hdbc = haskellPackagesNew.callPackage ./default.nix { }; + aesd-records = haskellPackagesNew.callPackage ../records/default.nix { }; + raft = haskellPackagesNew.callPackage ../../../../raft/default.nix { }; }; }; }; diff --git a/libs/Haskell/records-hdbc/shell.nix b/libs/Haskell/records-hdbc/shell.nix index 23855be..f02b5c3 100644 --- a/libs/Haskell/records-hdbc/shell.nix +++ b/libs/Haskell/records-hdbc/shell.nix @@ -1 +1,44 @@ -((import ./release.nix) {}).aesd-records-hdbc.env +{ + nixpkgs ? import +, compiler ? "ghc822" +}: + +let + + nixpkgs1 = + if nixpkgs == null + then let + bootstrap = import { }; + location = builtins.fromJSON (builtins.readFile ../nixpkgs.json); + src = bootstrap.fetchFromGitHub { + owner = "NixOS"; + repo = "nixpkgs"; + inherit (location) rev sha256; + }; + in + import src + else nixpkgs; + + pkgs = nixpkgs1 { }; + + release = (import ./release.nix) {nixpkgs = nixpkgs1; compiler = compiler;}; + + aesd-records-hdbc = release.aesd-records-hdbc; + + haskellPackages = pkgs.haskell.packages."${compiler}"; + +in + + pkgs.lib.overrideDerivation aesd-records-hdbc.env (old: { + buildInputs = old.buildInputs ++ [ + haskellPackages.cabal-install + # haskellPackages.ghc-mod + haskellPackages.ghcid + # haskellPackages.hasktags + haskellPackages.hdevtools + haskellPackages.hindent + haskellPackages.hlint + haskellPackages.pointfree + haskellPackages.pointful + ]; + }) diff --git a/libs/Haskell/records-hdbc/src/AESD/Records/Server/HDBC.hs b/libs/Haskell/records-hdbc/src/AESD/Records/Server/HDBC.hs index fb233dc..48189ee 100644 --- a/libs/Haskell/records-hdbc/src/AESD/Records/Server/HDBC.hs +++ b/libs/Haskell/records-hdbc/src/AESD/Records/Server/HDBC.hs @@ -1,6 +1,6 @@ {-| Module : $Header$ -Copyright : (c) 2017-18 Alliance for Sustainable Energy LLC +Copyright : (c) 2017-19 Alliance for Sustainable Energy LLC License : MIT Maintainer : Brian W Bush Stability : Stable diff --git a/libs/Haskell/records-hdbc/src/MainMySQL.hs b/libs/Haskell/records-hdbc/src/MainMySQL.hs index e5e8897..a5be3b1 100644 --- a/libs/Haskell/records-hdbc/src/MainMySQL.hs +++ b/libs/Haskell/records-hdbc/src/MainMySQL.hs @@ -1,6 +1,6 @@ {-| Module : $Header$ -Copyright : (c) 2017-18 Alliance for Sustainable Energy LLC +Copyright : (c) 2017-19 Alliance for Sustainable Energy LLC License : MIT Maintainer : Brian W Bush Stability : Stable @@ -26,7 +26,7 @@ module Main ( import AESD.Records.Server.HDBC (hdbcMain) import Control.Exception (bracket) import Data.Aeson.Types (FromJSON(..), ToJSON(..)) -import Data.Yaml (decodeFile) +import Data.Yaml (decodeFileEither) import Database.HDBC (disconnect) import Database.HDBC.MySQL (MySQLConnectInfo(..), connectMySQL) import GHC.Generics (Generic) @@ -66,7 +66,7 @@ main :: IO () main = do [configuration] <- getArgs - Just Configuration{..} <- decodeFile configuration + Right Configuration{..} <- decodeFileEither configuration bracket (connectMySQL database) disconnect diff --git a/libs/Haskell/records-hdbc/src/MainODBC.hs b/libs/Haskell/records-hdbc/src/MainODBC.hs index 003e633..8d30b43 100644 --- a/libs/Haskell/records-hdbc/src/MainODBC.hs +++ b/libs/Haskell/records-hdbc/src/MainODBC.hs @@ -1,6 +1,6 @@ {-| Module : $Header$ -Copyright : (c) 2017-18 Alliance for Sustainable Energy LLC +Copyright : (c) 2017-19 Alliance for Sustainable Energy LLC License : MIT Maintainer : Brian W Bush Stability : Stable @@ -23,7 +23,7 @@ module Main ( import AESD.Records.Server.HDBC (hdbcMain) import Control.Exception (bracket) import Data.Aeson.Types (FromJSON(..), ToJSON(..)) -import Data.Yaml (decodeFile) +import Data.Yaml (decodeFileEither) import Database.HDBC (disconnect) import Database.HDBC.ODBC (connectODBC) import GHC.Generics (Generic) @@ -53,7 +53,7 @@ main :: IO () main = do [configuration] <- getArgs - Just Configuration{..} <- decodeFile configuration + Right Configuration{..} <- decodeFileEither configuration bracket (connectODBC database) disconnect diff --git a/libs/Haskell/records-hdbc/src/MainPostgreSQL.hs b/libs/Haskell/records-hdbc/src/MainPostgreSQL.hs index 6c1de55..012d56b 100644 --- a/libs/Haskell/records-hdbc/src/MainPostgreSQL.hs +++ b/libs/Haskell/records-hdbc/src/MainPostgreSQL.hs @@ -1,6 +1,6 @@ {-| Module : $Header$ -Copyright : (c) 2017-18 Alliance for Sustainable Energy LLC +Copyright : (c) 2017-19 Alliance for Sustainable Energy LLC License : MIT Maintainer : Brian W Bush Stability : Stable @@ -23,7 +23,7 @@ module Main ( import AESD.Records.Server.HDBC (hdbcMain) import Control.Exception (bracket) import Data.Aeson.Types (FromJSON(..), ToJSON(..)) -import Data.Yaml (decodeFile) +import Data.Yaml (decodeFileEither) import Database.HDBC (disconnect) import Database.HDBC.PostgreSQL (connectPostgreSQL) import GHC.Generics (Generic) @@ -53,7 +53,7 @@ main :: IO () main = do [configuration] <- getArgs - Just Configuration{..} <- decodeFile configuration + Right Configuration{..} <- decodeFileEither configuration bracket (connectPostgreSQL database) disconnect diff --git a/libs/Haskell/records-hdbc/src/MainSQLite3.hs b/libs/Haskell/records-hdbc/src/MainSQLite3.hs index 6c5344b..5aae317 100644 --- a/libs/Haskell/records-hdbc/src/MainSQLite3.hs +++ b/libs/Haskell/records-hdbc/src/MainSQLite3.hs @@ -1,6 +1,6 @@ {-| Module : $Header$ -Copyright : (c) 2017-18 Alliance for Sustainable Energy LLC +Copyright : (c) 2017-19 Alliance for Sustainable Energy LLC License : MIT Maintainer : Brian W Bush Stability : Stable @@ -23,7 +23,7 @@ module Main ( import AESD.Records.Server.HDBC (hdbcMain) import Control.Exception (bracket) import Data.Aeson.Types (FromJSON(..), ToJSON(..)) -import Data.Yaml (decodeFile) +import Data.Yaml (decodeFileEither) import Database.HDBC (disconnect) import Database.HDBC.Sqlite3 (connectSqlite3) import GHC.Generics (Generic) @@ -53,7 +53,7 @@ main :: IO () main = do [configuration] <- getArgs - Just Configuration{..} <- decodeFile configuration + Right Configuration{..} <- decodeFileEither configuration bracket (connectSqlite3 database) disconnect diff --git a/libs/Haskell/records/aesd-records.cabal b/libs/Haskell/records/aesd-records.cabal index 97b3ba6..8fe5575 100644 --- a/libs/Haskell/records/aesd-records.cabal +++ b/libs/Haskell/records/aesd-records.cabal @@ -1,5 +1,5 @@ name : aesd-records -version : 0.4.4.4 +version : 0.5.0.0 synopsis : AESD Records description : Implementation of AESD Records API, include a skeletal server and client. @@ -11,7 +11,7 @@ license : MIT license-file : LICENSE author : Brian W Bush maintainer : Brian W Bush -copyright : (c) 2016-18 Alliance for Sustainable Energy LLC +copyright : (c) 2016-19 Alliance for Sustainable Energy LLC category : Network build-type : Simple cabal-version: >= 1.10 @@ -49,7 +49,7 @@ library AESD.Types.Variable Network.WebSockets.STM other-modules : AESD.Types.Internal - build-depends : base >= 4.8 && < 4.9 + build-depends : base >= 4 && < 5 , bytestring , cereal , containers @@ -69,8 +69,23 @@ library ghc-options : -Wall -O2 executable aesd-file-server - main-is : MainServer.hs hs-source-dirs : src + main-is : MainServer.hs + other-modules : AESD.Records.Server + AESD.Records.Server.File + AESD.Records.Server.Manager + AESD.Types + AESD.Types.Bookmark + AESD.Types.Domain + AESD.Types.Filter + AESD.Types.Internal + AESD.Types.Model + AESD.Types.Record + AESD.Types.Request + AESD.Types.Response + AESD.Types.Value + AESD.Types.Variable + Network.WebSockets.STM build-depends : base , bytestring , cereal @@ -94,8 +109,22 @@ executable aesd-file-server ghc-options : -Wall -O2 -threaded executable aesd-random-server - main-is : MainRandomServer.hs hs-source-dirs : src + main-is : MainRandomServer.hs + other-modules : AESD.Records.Server + AESD.Records.Server.Manager + AESD.Types + AESD.Types.Bookmark + AESD.Types.Domain + AESD.Types.Filter + AESD.Types.Internal + AESD.Types.Model + AESD.Types.Record + AESD.Types.Request + AESD.Types.Response + AESD.Types.Value + AESD.Types.Variable + Network.WebSockets.STM build-depends : base , bytestring , cereal @@ -118,8 +147,23 @@ executable aesd-random-server ghc-options : -Wall -O2 -threaded executable aesd-client-example - main-is : MainClientExample.hs hs-source-dirs : src + main-is : MainClientExample.hs + other-modules : AESD.Records.Client + AESD.Records.Server + AESD.Records.Server.Manager + AESD.Types + AESD.Types.Bookmark + AESD.Types.Domain + AESD.Types.Filter + AESD.Types.Internal + AESD.Types.Model + AESD.Types.Record + AESD.Types.Request + AESD.Types.Response + AESD.Types.Value + AESD.Types.Variable + Network.WebSockets.STM build-depends : base , bytestring , cereal diff --git a/libs/Haskell/records/aesd-records.config b/libs/Haskell/records/aesd-records.config index a2b5d7e..dfd0667 100644 --- a/libs/Haskell/records/aesd-records.config +++ b/libs/Haskell/records/aesd-records.config @@ -1,23 +1,24 @@ -constraints: SHA ==1.6.4.2, - StateVar ==1.1.0.4, - adjunctions ==4.3, - aeson ==1.1.2.0, - array ==0.5.1.0, - attoparsec ==0.13.1.0, - base ==4.8.2.0, - base-compat ==0.9.3, - base-orphans ==0.6, +constraints: SHA ==1.6.4.4, + StateVar ==1.1.1.1, + adjunctions ==4.4, + aeson ==1.3.1.1, + array ==0.5.2.0, + async ==2.2.1, + attoparsec ==0.13.2.2, + base ==4.10.1.0, + base-compat ==0.10.4, + base-orphans ==0.7, base64-bytestring ==1.0.0.1, - bifunctors ==5.4.2, - binary ==0.7.5.0, - blaze-builder ==0.4.0.2, - bytestring ==0.10.6.0, + bifunctors ==5.5.3, + binary ==0.8.5.1, + bytestring ==0.10.8.2, + bytestring-builder ==0.10.8.1.0, call-stack ==0.1.0, - case-insensitive ==1.2.0.10, - cereal ==0.5.4.0, - comonad ==5.0.2, - containers ==0.5.6.2, - contravariant ==1.4, + case-insensitive ==1.2.0.11, + cereal ==0.5.7.0, + comonad ==5.0.4, + containers ==0.5.10.2, + contravariant ==1.4.1, cryptohash-md5 ==0.11.100.1, cryptohash-sha1 ==0.11.100.1, data-binary-ieee754 ==0.4.4, @@ -26,58 +27,60 @@ constraints: SHA ==1.6.4.2, data-default-instances-containers ==0.0.1, data-default-instances-dlist ==0.0.1, data-default-instances-old-locale ==0.0.1, - deepseq ==1.4.1.1, - directory ==1.2.2.0, + deepseq ==1.4.3.0, + directory ==1.3.0.2, distributive ==0.5.3, - dlist ==0.8.0.3, - entropy ==0.3.8, - exceptions ==0.8.3, - fail ==4.9.0.0, - filepath ==1.4.0.0, - free ==4.12.4, - generic-deriving ==1.11.2, - ghc-prim ==0.4.0.0, - hashable ==1.2.6.1, - integer-gmp ==1.0.0.0, - integer-logarithms ==1.0.2, - kan-extensions ==5.0.2, - lens ==4.15.4, - mtl ==2.2.1, - network ==2.6.3.2, - network-info ==0.2.0.8, + dlist ==0.8.0.4, + entropy ==0.4.1.1, + exceptions ==0.10.0, + filepath ==1.4.1.2, + free ==5.0.2, + ghc-boot-th ==8.2.2, + ghc-prim ==0.5.1.1, + hashable ==1.2.7.0, + integer-gmp ==1.0.1.0, + integer-logarithms ==1.0.2.1, + invariant ==0.5.1, + kan-extensions ==5.2, + lens ==4.16.1, + mtl ==2.2.2, + network ==2.6.3.6, + network-info ==0.2.0.10, old-locale ==1.0.0.7, - parallel ==3.2.1.1, - prelude-extras ==0.4.0.3, - pretty ==1.1.2.0, - primitive ==0.6.2.0, - profunctors ==5.2.1, - protobuf ==0.2.1.1, - raft ==0.3.11.1, + parallel ==3.2.2.0, + pretty ==1.1.3.3, + primitive ==0.6.3.0, + process ==1.6.1.0, + profunctors ==5.2.2, + protobuf ==0.2.1.2, + raft ==0.4.0.0, random ==1.1, - reflection ==2.1.2, + reflection ==2.1.4, regex-base ==0.93.2, regex-posix ==0.95.2, rts ==1.0, - scientific ==0.3.5.2, - semigroupoids ==5.2.1, - semigroups ==0.18.3, - split ==0.2.3.2, - stm ==2.4.4.1, + scientific ==0.3.6.2, + semigroupoids ==5.2.2, + semigroups ==0.18.5, + split ==0.2.3.3, + stm ==2.4.5.1, + streaming-commons ==0.2.1.0, tagged ==0.8.5, - template-haskell ==2.10.0.0, - text ==1.2.2.2, - th-abstraction ==0.2.5.0, - time ==1.5.0.1, - time-locale-compat ==0.1.1.3, + template-haskell ==2.12.0.0, + text ==1.2.3.0, + th-abstraction ==0.2.8.0, + time ==1.8.0.2, + time-locale-compat ==0.1.1.5, tostring ==0.2.1.1, - transformers ==0.4.2.0, - transformers-compat ==0.5.1.4, - unix ==2.7.1.0, - unordered-containers ==0.2.8.0, + transformers ==0.5.2.0, + transformers-base ==0.4.5.2, + transformers-compat ==0.6.2, + unix ==2.7.2.2, + unordered-containers ==0.2.9.0, utf8-string ==1.0.1.1, uuid ==1.3.13, uuid-types ==1.0.3, vector ==0.12.0.1, void ==0.7.2, - websockets ==0.10.0.0, - zlib ==0.6.1.2 + websockets ==0.12.5.1, + zlib ==0.6.2 diff --git a/libs/Haskell/records/default.nix b/libs/Haskell/records/default.nix index d6ad3d7..cced26a 100644 --- a/libs/Haskell/records/default.nix +++ b/libs/Haskell/records/default.nix @@ -1,22 +1,20 @@ -{ mkDerivation, base, bytestring, cereal, containers, data-default -, directory, filepath, lens, mtl, protobuf, raft, random -, regex-posix, split, stdenv, stm, uuid, websockets +{ + mkDerivation, stdenv +, base, bytestring, cereal, containers, data-default, directory, filepath, lens, mtl, protobuf, raft, random , regex-posix, split, stm, uuid, websockets }: mkDerivation { pname = "aesd-records"; - version = "0.4.4.4"; + version = "0.5.0.0"; src = ./.; isLibrary = true; isExecutable = true; libraryHaskellDepends = [ - base bytestring cereal containers data-default lens mtl protobuf - raft regex-posix split stm uuid websockets + base bytestring cereal containers data-default lens mtl protobuf raft regex-posix split stm uuid websockets ]; executableHaskellDepends = [ - base bytestring cereal containers data-default directory filepath - lens mtl protobuf raft random regex-posix split stm uuid websockets + base bytestring cereal containers data-default directory filepath lens mtl protobuf raft random regex-posix split stm uuid websockets ]; - homepage = "https://github.com/NREL/AESD/libs/Haskell/aesd-records"; + homepage = "https://github.com/NREL/AESD/libs/Haskell/aesd-records/ReadMe.md"; description = "AESD Records"; license = stdenv.lib.licenses.mit; } diff --git a/libs/Haskell/records/release.nix b/libs/Haskell/records/release.nix index c563fe3..c0fb281 100644 --- a/libs/Haskell/records/release.nix +++ b/libs/Haskell/records/release.nix @@ -1,4 +1,7 @@ -{ compiler ? "ghc7103" }: +{ + nixpkgs ? import +, compiler ? "ghc822" +}: let config = { @@ -7,8 +10,8 @@ let packages = pkgs.haskell.packages // { "${compiler}" = pkgs.haskell.packages."${compiler}".override { overrides = haskellPackagesNew: haskellPackagesOld: rec { - aesd-records = - haskellPackagesNew.callPackage ./default.nix { }; + aesd-records = haskellPackagesNew.callPackage ./default.nix { }; + raft = haskellPackagesNew.callPackage ../../../../raft/default.nix { }; }; }; }; @@ -19,6 +22,7 @@ let pkgs = import { inherit config; }; in + { - aesd-records = pkgs.haskell.packages.${compiler}.aesd-records; + aesd-records = pkgs.haskell.packages.${compiler}.aesd-records; } diff --git a/libs/Haskell/records/shell.nix b/libs/Haskell/records/shell.nix index ae4cb78..df79150 100644 --- a/libs/Haskell/records/shell.nix +++ b/libs/Haskell/records/shell.nix @@ -1 +1,44 @@ -((import ./release.nix) {}).aesd-records.env +{ + nixpkgs ? import +, compiler ? "ghc822" +}: + +let + + nixpkgs1 = + if nixpkgs == null + then let + bootstrap = import { }; + location = builtins.fromJSON (builtins.readFile ../nixpkgs.json); + src = bootstrap.fetchFromGitHub { + owner = "NixOS"; + repo = "nixpkgs"; + inherit (location) rev sha256; + }; + in + import src + else nixpkgs; + + pkgs = nixpkgs1 { }; + + release = (import ./release.nix) {nixpkgs = nixpkgs1; compiler = compiler;}; + + aesd-records = release.aesd-records; + + haskellPackages = pkgs.haskell.packages."${compiler}"; + +in + + pkgs.lib.overrideDerivation aesd-records.env (old: { + buildInputs = old.buildInputs ++ [ + haskellPackages.cabal-install + # haskellPackages.ghc-mod + haskellPackages.ghcid + # haskellPackages.hasktags + haskellPackages.hdevtools + haskellPackages.hindent + haskellPackages.hlint + haskellPackages.pointfree + haskellPackages.pointful + ]; + }) diff --git a/libs/Haskell/records/src/AESD/Records/Client.hs b/libs/Haskell/records/src/AESD/Records/Client.hs index 3226ce5..8c3cf90 100644 --- a/libs/Haskell/records/src/AESD/Records/Client.hs +++ b/libs/Haskell/records/src/AESD/Records/Client.hs @@ -1,6 +1,6 @@ {-| Module : $Header$ -Copyright : (c) 2016-18 Alliance for Sustainable Energy LLC +Copyright : (c) 2016-19 Alliance for Sustainable Energy LLC License : MIT Maintainer : Brian W Bush Stability : Stable @@ -11,7 +11,6 @@ A skeletal implementation of a client. {-# LANGUAGE RecordWildCards #-} -{-# LANGUAGE TupleSections #-} module AESD.Records.Client ( @@ -37,10 +36,10 @@ import AESD.Types.Response as Response (Response, identifier, nextChunkIdentifie import Control.Concurrent.Util (makeCounter) import Control.Lens.Getter ((^.)) import Control.Lens.Lens ((&)) -import Control.Lens.Setter ((.~), over) +import Control.Lens.Setter ((.~), (?~), over) import Control.Concurrent.MVar (newEmptyMVar, putMVar, takeMVar) import Control.Concurrent.STM (atomically) -import Control.Concurrent.STM.TVar (TVar, modifyTVar', newTVarIO, readTVar, writeTVar) +import Control.Concurrent.STM.TVar (TVar, modifyTVar', newTVarIO, readTVar, readTVarIO, writeTVar) import Control.Monad (liftM2, when) import Control.Monad.Except (liftIO) import Data.Default (def) @@ -116,7 +115,7 @@ fetchRecords :: State -- ^ The state of the client. fetchRecords State{..} i c = do -- Check if the model is on the server. - found <- M.member i <$> atomically (readTVar modelCache) + found <- M.member i <$> readTVarIO modelCache if found then do -- FIXME: Generalize 'accumulate' to this case, too? @@ -187,7 +186,7 @@ makeModelCache :: Connection -- ^ The web socket connection. -> IO State -- ^ Action to create the state with a new model cache. makeModelCache connection = do - communicator <- start connection ((Request.identifier .~) . Just) (fromJust . (^. Response.identifier)) + communicator <- start connection (Request.identifier ?~) (fromJust . (^. Response.identifier)) nextIdentifier <- liftIO $ makeCounter (+ 1) 0 modelCache <- newTVarIO M.empty return State{..} diff --git a/libs/Haskell/records/src/AESD/Records/Server.hs b/libs/Haskell/records/src/AESD/Records/Server.hs index 3d60d27..88d4576 100644 --- a/libs/Haskell/records/src/AESD/Records/Server.hs +++ b/libs/Haskell/records/src/AESD/Records/Server.hs @@ -1,6 +1,6 @@ {-| Module : $Header$ -Copyright : (c) 2016-18 Alliance for Sustainable Energy LLC +Copyright : (c) 2016-19 Alliance for Sustainable Energy LLC License : MIT Maintainer : Brian W Bush Stability : Stable @@ -42,7 +42,7 @@ import Control.Concurrent.STM (atomically) import Control.Concurrent.STM.TVar (TVar, modifyTVar', newTVarIO, readTVar, readTVarIO, writeTVar) import Control.Lens.Getter ((^.)) import Control.Lens.Lens ((&)) -import Control.Lens.Setter ((.~)) +import Control.Lens.Setter ((.~), (?~)) import Control.Monad (unless, void) import Control.Monad.Except (ExceptT, MonadError, MonadIO, liftIO, runExceptT, throwError) import Control.Monad.Except.Util (guardSomeException) @@ -124,7 +124,7 @@ serverMain host port chunkSize initialManager = cid' = cid + 1 send communicator () . (Response.identifier .~ rid ) - . (chunkIdentifier .~ Just cid ) + . (chunkIdentifier ?~ cid ) . (nextChunkIdentifier .~ if lastChunk then Nothing else Just cid') $ either errorResponse recordsResponse result pause diff --git a/libs/Haskell/records/src/AESD/Records/Server/File.hs b/libs/Haskell/records/src/AESD/Records/Server/File.hs index a8c4df8..c37eef7 100644 --- a/libs/Haskell/records/src/AESD/Records/Server/File.hs +++ b/libs/Haskell/records/src/AESD/Records/Server/File.hs @@ -1,6 +1,6 @@ {-| Module : $Header$ -Copyright : (c) 2016-18 Alliance for Sustainable Energy LLC +Copyright : (c) 2016-19 Alliance for Sustainable Energy LLC License : MIT Maintainer : Brian W Bush Stability : Stable @@ -28,6 +28,9 @@ import Data.Default (def) import Text.Regex.Posix ((=~)) +{-# ANN module "HLint: ignore Reduce duplication" #-} + + -- | Construct variable metadata for a table of data. The strings in the table are analyzed to determine whether each column is a real, integer, or string value. If the name of the variable contains its units in square brackets, the units are separated from the variable and put in the units metadata. buildVarMetas :: [[String]] -- ^ The rows of data. -> [VarMeta] -- ^ The variable metadata for each column of the table. diff --git a/libs/Haskell/records/src/AESD/Records/Server/Manager.hs b/libs/Haskell/records/src/AESD/Records/Server/Manager.hs index 5cc518e..d06e18f 100644 --- a/libs/Haskell/records/src/AESD/Records/Server/Manager.hs +++ b/libs/Haskell/records/src/AESD/Records/Server/Manager.hs @@ -1,6 +1,6 @@ {-| Module : $Header$ -Copyright : (c) 2016-18 Alliance for Sustainable Energy LLC +Copyright : (c) 2016-19 Alliance for Sustainable Energy LLC License : MIT Maintainer : Brian W Bush Stability : Stable diff --git a/libs/Haskell/records/src/AESD/Types.hs b/libs/Haskell/records/src/AESD/Types.hs index be32824..5d52991 100644 --- a/libs/Haskell/records/src/AESD/Types.hs +++ b/libs/Haskell/records/src/AESD/Types.hs @@ -1,6 +1,6 @@ {-| Module : $Header$ -Copyright : (c) 2016-18 Alliance for Sustainable Energy LLC +Copyright : (c) 2016-19 Alliance for Sustainable Energy LLC License : MIT Maintainer : Brian W Bush Stability : Stable diff --git a/libs/Haskell/records/src/AESD/Types/Bookmark.hs b/libs/Haskell/records/src/AESD/Types/Bookmark.hs index 851abe7..3d04790 100644 --- a/libs/Haskell/records/src/AESD/Types/Bookmark.hs +++ b/libs/Haskell/records/src/AESD/Types/Bookmark.hs @@ -1,6 +1,6 @@ {-| Module : $Header$ -Copyright : (c) 2016-18 Alliance for Sustainable Energy LLC +Copyright : (c) 2016-19 Alliance for Sustainable Energy LLC License : MIT Maintainer : Brian W Bush Stability : Stable diff --git a/libs/Haskell/records/src/AESD/Types/Domain.hs b/libs/Haskell/records/src/AESD/Types/Domain.hs index ca6a323..e403064 100644 --- a/libs/Haskell/records/src/AESD/Types/Domain.hs +++ b/libs/Haskell/records/src/AESD/Types/Domain.hs @@ -1,6 +1,6 @@ {-| Module : $Header$ -Copyright : (c) 2016-18 Alliance for Sustainable Energy LLC +Copyright : (c) 2016-19 Alliance for Sustainable Energy LLC License : MIT Maintainer : Brian W Bush Stability : Stable diff --git a/libs/Haskell/records/src/AESD/Types/Filter.hs b/libs/Haskell/records/src/AESD/Types/Filter.hs index a31aa85..8f130fb 100644 --- a/libs/Haskell/records/src/AESD/Types/Filter.hs +++ b/libs/Haskell/records/src/AESD/Types/Filter.hs @@ -1,6 +1,6 @@ {-| Module : $Header$ -Copyright : (c) 2016-18 Alliance for Sustainable Energy LLC +Copyright : (c) 2016-19 Alliance for Sustainable Energy LLC License : MIT Maintainer : Brian W Bush Stability : Stable diff --git a/libs/Haskell/records/src/AESD/Types/Internal.hs b/libs/Haskell/records/src/AESD/Types/Internal.hs index 9627803..5a5ce85 100644 --- a/libs/Haskell/records/src/AESD/Types/Internal.hs +++ b/libs/Haskell/records/src/AESD/Types/Internal.hs @@ -1,6 +1,6 @@ {-| Module : $Header$ -Copyright : (c) 2016-18 Alliance for Sustainable Energy LLC +Copyright : (c) 2016-19 Alliance for Sustainable Energy LLC License : MIT Maintainer : Brian W Bush Stability : Stable @@ -49,7 +49,7 @@ import Data.ProtocolBuffers (Decode, Encode, Packed, Repeated, Required, Value, import Data.Serialize (runGetLazy, runPutLazy) import Data.Word (Word32) import GHC.Generics (Generic) -import Network.WebSockets (WebSocketsData(..)) +import Network.WebSockets (DataMessage(..), WebSocketsData(..)) -- | A signed integer. @@ -204,5 +204,7 @@ strings = getField . strings' -- Enable protocol buffers for transport via web sockets. instance (Decode a, Encode a) => WebSocketsData a where + fromDataMessage (Text bs _) = either error id $ runGetLazy decodeMessage bs + fromDataMessage (Binary bs ) = either error id $ runGetLazy decodeMessage bs fromLazyByteString = either error id . runGetLazy decodeMessage toLazyByteString = runPutLazy . encodeMessage diff --git a/libs/Haskell/records/src/AESD/Types/Model.hs b/libs/Haskell/records/src/AESD/Types/Model.hs index d2db004..e796dc5 100644 --- a/libs/Haskell/records/src/AESD/Types/Model.hs +++ b/libs/Haskell/records/src/AESD/Types/Model.hs @@ -1,6 +1,6 @@ {-| Module : $Header$ -Copyright : (c) 2016-18 Alliance for Sustainable Energy LLC +Copyright : (c) 2016-19 Alliance for Sustainable Energy LLC License : MIT Maintainer : Brian W Bush Stability : Stable diff --git a/libs/Haskell/records/src/AESD/Types/Record.hs b/libs/Haskell/records/src/AESD/Types/Record.hs index 7c94551..fd0e019 100644 --- a/libs/Haskell/records/src/AESD/Types/Record.hs +++ b/libs/Haskell/records/src/AESD/Types/Record.hs @@ -1,6 +1,6 @@ {-| Module : $Header$ -Copyright : (c) 2016-18 Alliance for Sustainable Energy LLC +Copyright : (c) 2016-19 Alliance for Sustainable Energy LLC License : MIT Maintainer : Brian W Bush Stability : Stable @@ -40,7 +40,7 @@ import Control.Applicative ((<|>)) import Control.Arrow (second) import Control.Lens.Getter ((^.)) import Control.Lens.Lens (Lens', (&), lens) -import Control.Lens.Setter ((.~)) +import Control.Lens.Setter ((.~), (?~)) import Data.Default (Default(..)) import Data.Int (Int64) import Data.List.Split (chunksOf) @@ -49,6 +49,9 @@ import Data.ProtocolBuffers (Decode, Encode, Message, Optional, Packed, Repeated import GHC.Generics (Generic) +{-# ANN module "HLint: ignore Use newtype instead of data" #-} + + -- | A value of a variable. data VarValue = VarValue @@ -230,9 +233,9 @@ recordTable = ( \s x -> onDataValues - ((realTable .~) . Just) - ((integerTable .~) . Just) - ((stringTable .~) . Just) + (realTable ?~) + (integerTable ?~) + (stringTable ?~) (id :: RecordTable -> RecordTable ) (fmap snd . snd =<< x :: [DataValue]) $ s diff --git a/libs/Haskell/records/src/AESD/Types/Request.hs b/libs/Haskell/records/src/AESD/Types/Request.hs index c451469..86db6d6 100644 --- a/libs/Haskell/records/src/AESD/Types/Request.hs +++ b/libs/Haskell/records/src/AESD/Types/Request.hs @@ -1,6 +1,6 @@ {-| Module : $Header$ -Copyright : (c) 2016-18 Alliance for Sustainable Energy LLC +Copyright : (c) 2016-19 Alliance for Sustainable Energy LLC License : MIT Maintainer : Brian W Bush Stability : Stable diff --git a/libs/Haskell/records/src/AESD/Types/Response.hs b/libs/Haskell/records/src/AESD/Types/Response.hs index c29ba0e..ffde052 100644 --- a/libs/Haskell/records/src/AESD/Types/Response.hs +++ b/libs/Haskell/records/src/AESD/Types/Response.hs @@ -1,6 +1,6 @@ {-| Module : $Header$ -Copyright : (c) 2016-18 Alliance for Sustainable Energy LLC +Copyright : (c) 2016-19 Alliance for Sustainable Energy LLC License : MIT Maintainer : Brian W Bush Stability : Stable diff --git a/libs/Haskell/records/src/AESD/Types/Value.hs b/libs/Haskell/records/src/AESD/Types/Value.hs index b2f6f1a..f41d1d6 100644 --- a/libs/Haskell/records/src/AESD/Types/Value.hs +++ b/libs/Haskell/records/src/AESD/Types/Value.hs @@ -1,6 +1,6 @@ {-| Module : $Header$ -Copyright : (c) 2016-18 Alliance for Sustainable Energy LLC +Copyright : (c) 2016-19 Alliance for Sustainable Energy LLC License : MIT Maintainer : Brian W Bush Stability : Stable diff --git a/libs/Haskell/records/src/AESD/Types/Variable.hs b/libs/Haskell/records/src/AESD/Types/Variable.hs index 0d9d02b..0d3e48f 100644 --- a/libs/Haskell/records/src/AESD/Types/Variable.hs +++ b/libs/Haskell/records/src/AESD/Types/Variable.hs @@ -1,6 +1,6 @@ {-| Module : $Header$ -Copyright : (c) 2016-18 Alliance for Sustainable Energy LLC +Copyright : (c) 2016-19 Alliance for Sustainable Energy LLC License : MIT Maintainer : Brian W Bush Stability : Stable diff --git a/libs/Haskell/records/src/MainClientExample.hs b/libs/Haskell/records/src/MainClientExample.hs index 64bd538..c8145d0 100644 --- a/libs/Haskell/records/src/MainClientExample.hs +++ b/libs/Haskell/records/src/MainClientExample.hs @@ -1,6 +1,6 @@ {-| Module : $Header$ -Copyright : (c) 2016-18 Alliance for Sustainable Energy LLC +Copyright : (c) 2016-19 Alliance for Sustainable Energy LLC License : MIT Maintainer : Brian W Bush Stability : Stable diff --git a/libs/Haskell/records/src/MainRandomServer.hs b/libs/Haskell/records/src/MainRandomServer.hs index 9f85086..6bddcaf 100644 --- a/libs/Haskell/records/src/MainRandomServer.hs +++ b/libs/Haskell/records/src/MainRandomServer.hs @@ -1,6 +1,6 @@ {-| Module : $Header$ -Copyright : (c) 2016-18 Alliance for Sustainable Energy LLC +Copyright : (c) 2016-19 Alliance for Sustainable Energy LLC License : MIT Maintainer : Brian W Bush Stability : Stable @@ -10,9 +10,6 @@ Server for random data. -} -{-# LANGUAGE TupleSections #-} - - module Main ( -- * Entry point main diff --git a/libs/Haskell/records/src/MainServer.hs b/libs/Haskell/records/src/MainServer.hs index 7d4bb70..3c61d6c 100644 --- a/libs/Haskell/records/src/MainServer.hs +++ b/libs/Haskell/records/src/MainServer.hs @@ -1,6 +1,6 @@ {-| Module : $Header$ -Copyright : (c) 2016-18 Alliance for Sustainable Energy LLC +Copyright : (c) 2016-19 Alliance for Sustainable Energy LLC License : MIT Maintainer : Brian W Bush Stability : Stable diff --git a/libs/Haskell/records/src/Network/WebSockets/STM.hs b/libs/Haskell/records/src/Network/WebSockets/STM.hs index 723c8d2..72504a9 100644 --- a/libs/Haskell/records/src/Network/WebSockets/STM.hs +++ b/libs/Haskell/records/src/Network/WebSockets/STM.hs @@ -1,6 +1,6 @@ {-| Module : $Header$ -Copyright : (c) 2018 Alliance for Sustainable Energy LLC +Copyright : (c) 2018-19 Alliance for Sustainable Energy LLC License : MIT Maintainer : Brian W Bush Stability : Stable