From 28b691bbd04697f6a89146016b6de7a00fbea325 Mon Sep 17 00:00:00 2001 From: nek0 Date: Fri, 15 Nov 2019 18:51:51 +0100 Subject: [PATCH] foo --- mateamt.cabal | 8 +++--- shell.nix | 76 +++++++++++++++++++++++++++++++++++++++++++++------ src/API.hs | 50 ++++++++++++++++----------------- 3 files changed, 96 insertions(+), 38 deletions(-) diff --git a/mateamt.cabal b/mateamt.cabal index a7c48af..be253f9 100644 --- a/mateamt.cabal +++ b/mateamt.cabal @@ -26,7 +26,7 @@ executable mateamt , AppTypes.Configuration , Janitor -- other-extensions: - build-depends: base ^>=4.12.0.0 + build-depends: base >=4.12.0.0 && < 5 , mateamt , text , bytestring @@ -43,7 +43,7 @@ executable mateamt , warp , wai , wai-logger - , HsYAML + , HsYAML >= 0.2.1.0 , optparse-applicative hs-source-dirs: app ghc-options: -Wall @@ -77,10 +77,10 @@ library , Types.Avatar , Util -- other-extensions: - build-depends: base ^>=4.12.0.0 + build-depends: base >=4.12.0.0 && < 5 , servant , servant-server - , servant-rawm + , servant-rawm >= 0.3.0.0 , opaleye , aeson , text diff --git a/shell.nix b/shell.nix index 32d1574..b66a909 100644 --- a/shell.nix +++ b/shell.nix @@ -4,22 +4,80 @@ let inherit (nixpkgs) pkgs; - f = { mkDerivation, aeson, base, base16-bytestring, bytestring - , containers, http-api-data, mtl, opaleye, postgresql-simple - , product-profunctors, random-bytestring, servant, servant-server - , stdenv, stm, text, time, wai, wai-logger, warp + servant-rawm = with haskellPackages; callPackage( + { mkDerivation, base, bytestring, doctest, filepath, Glob + , hspec-wai, http-client, http-media, http-types, lens, resourcet + , servant, servant-client, servant-client-core, servant-docs + , servant-server, stdenv, tasty, tasty-hspec, tasty-hunit, text + , transformers, wai, wai-app-static, warp + }: + mkDerivation { + pname = "servant-rawm"; + version = "0.3.2.0"; + sha256 = "2d90c1f6a284673ed28fc617170f191f5ed2f45ffd14e61fe49c575a7f426d04"; + isLibrary = true; + isExecutable = true; + libraryHaskellDepends = [ + base bytestring filepath http-client http-media http-types lens + resourcet servant-client servant-client-core servant-docs + servant-server wai wai-app-static + ]; + testHaskellDepends = [ + base bytestring doctest Glob hspec-wai http-client http-media + http-types servant servant-client servant-client-core + servant-server tasty tasty-hspec tasty-hunit text transformers wai + warp + ]; + homepage = "https://github.com/cdepillabout/servant-rawm"; + description = "Embed a raw 'Application' in a Servant API"; + license = stdenv.lib.licenses.bsd3; + }) {}; + + HsYAML = with haskellPackages; callPackage( + { mkDerivation, base, bytestring, containers, deepseq, mtl, parsec + , QuickCheck, stdenv, tasty, tasty-quickcheck, text + }: + mkDerivation { + pname = "HsYAML"; + version = "0.2.1.0"; + sha256 = "60f727d5c90e693ef71df7dcbed8f40b66d2db11375528043e0326749e861f83"; + isLibrary = true; + isExecutable = true; + libraryHaskellDepends = [ + base bytestring containers deepseq mtl parsec text + ]; + testHaskellDepends = [ + base bytestring containers mtl QuickCheck tasty tasty-quickcheck + text + ]; + homepage = "https://github.com/hvr/HsYAML"; + description = "Pure Haskell YAML 1.2 processor"; + license = stdenv.lib.licenses.gpl2; + }) {}; + + f = { mkDerivation, aeson, base, base16-bytestring + , base64-bytestring, bytestring, containers, http-api-data + , http-types, mtl, network, opaleye, optparse-applicative + , postgresql-simple, product-profunctors, profunctors, pureMD5 + , random-bytestring, servant, servant-server, stdenv + , stm, text, time, wai, wai-logger, warp }: mkDerivation { pname = "mateamt"; version = "0.0.0.0"; src = ./.; - configureFlags = [ "-fdevelop" ]; - isLibrary = false; + isLibrary = true; isExecutable = true; + libraryHaskellDepends = [ + aeson base base16-bytestring base64-bytestring bytestring + containers http-api-data http-types mtl opaleye postgresql-simple + product-profunctors profunctors pureMD5 random-bytestring servant + servant-rawm servant-server stm text time wai wai-logger warp + ]; executableHaskellDepends = [ - aeson base base16-bytestring bytestring containers http-api-data - mtl opaleye postgresql-simple product-profunctors random-bytestring - servant servant-server stm text time wai wai-logger warp + base base16-bytestring bytestring containers HsYAML mtl network + opaleye optparse-applicative postgresql-simple servant + servant-server stm text time wai wai-logger warp ]; description = "A whole new matemat"; license = stdenv.lib.licenses.agpl3; diff --git a/src/API.hs b/src/API.hs index 385c47e..ef4367e 100644 --- a/src/API.hs +++ b/src/API.hs @@ -91,39 +91,39 @@ buyLink :: Link journalShowLink :: Maybe Int -> Maybe Int -> Link -avatarGetLink :: Int -> Link +-- avatarGetLink :: Int -> Link avaterInsertLink :: Link avatarUpdateLink :: Int -> Link avatarListLink :: Link -( (authGetLink :: Link) :<|> - (authSendLink :: Link) :<|> - (authLogoutLink :: Link) :<|> +( authGetLink :<|> + authSendLink :<|> + authLogoutLink :<|> - (authManageListLink :: Link) :<|> - (authManageNewAuthLink :: Link) :<|> - (authManageDeleteAuthLink :: Link) :<|> + authManageListLink :<|> + authManageNewAuthLink :<|> + authManageDeleteAuthLink :<|> - (userNewLink :: Link) :<|> - (userGetLink :: Link) :<|> - (userUpdateLink :: Link) :<|> - (userListLink :: Maybe UserRefine -> Link) :<|> - (userRechargeLink :: Link) :<|> - (userTransferLink :: Link) :<|> + userNewLink :<|> + userGetLink :<|> + userUpdateLink :<|> + userListLink :<|> + userRechargeLink :<|> + userTransferLink :<|> - (productNewLink :: Link) :<|> - (productOverviewLink :: Int -> Link) :<|> - (productStockRefillLink :: Link) :<|> - (productStockUpdateLink :: Link) :<|> - (productListLink :: Maybe ProductRefine -> Link) :<|> - (productShortListLink :: Maybe ProductRefine -> Link) :<|> + productNewLink :<|> + productOverviewLink :<|> + productStockRefillLink :<|> + productStockUpdateLink :<|> + productListLink :<|> + productShortListLink :<|> - (buyLink :: Link) :<|> + buyLink :<|> - (journalShowLink :: Maybe Int -> Maybe Int -> Link) :<|> + journalShowLink :<|> - (avatarGetLink :: Int -> Link) :<|> - (avaterInsertLink :: Link) :<|> - (avatarUpdateLink :: Int -> Link) :<|> - (avatarListLink :: Link) + avatarGetLink :<|> + avaterInsertLink :<|> + avatarUpdateLink :<|> + avatarListLink ) = allLinks (Proxy :: Proxy MateAPI)