From 72a7aaa39e7552970f466e712e1f7ef91aeb03c8 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Thu, 10 Jun 2021 08:14:16 -0400 Subject: Upgrade to nixos-21.05 Getting me closer to the latest GHC. This release also includes my own packages that I submitted some time ago. GHCJS is not present in 21.05 for some reason, but I think it's back in master, so I might do another upgrade soon, but for now I just disabled my GHCJS support. I'm not really using it anyway. I also had to bring it string-quote, update nixos-mailserver, and a few other things. --- Alpha.hs | 6 ++-- Biz/Bild.hs | 77 +++++++++++++++++++++--------------------- Biz/Bild.nix | 77 +++++++++++++++++++++--------------------- Biz/Bild/Deps.nix | 53 +++++++++++++++-------------- Biz/Bild/Deps/Haskell.nix | 1 - Biz/Bild/Deps/guile-opengl.nix | 3 +- Biz/Bild/Deps/inspekt3d.nix | 3 +- Biz/Bild/Nixpkgs.nix | 1 + Biz/Bild/Sources.json | 36 ++++++++++++++++---- Biz/Bot.nix | 2 +- Biz/Cloud.nix | 10 +++--- Biz/Cloud/Git.nix | 1 + Biz/Dev/Configuration.nix | 2 +- Biz/Devalloc.hs | 18 +++------- Biz/Devalloc.nix | 2 +- Biz/Que/Host.nix | 2 +- Biz/Que/Site.nix | 2 +- Data/String/Quote.hs | 37 ++++++++++++++++++++ Hero/Host.hs | 1 - Hero/Node.hs | 1 - Hero/Service.nix | 2 +- 21 files changed, 195 insertions(+), 142 deletions(-) create mode 100644 Data/String/Quote.hs diff --git a/Alpha.hs b/Alpha.hs index edaa130..6245614 100644 --- a/Alpha.hs +++ b/Alpha.hs @@ -79,10 +79,10 @@ where import qualified Data.Char as Char import qualified Data.List as List import Data.String -import Data.Text (Text) import qualified Data.Text as Text import qualified Data.Text.Lazy as LazyText import Protolude as X hiding (list, ($), (&), (.), (>>=)) +import Protolude.Conv import qualified Prelude -- | Create a list. This should be @Data.List.singleton@ but that doesn't exist. @@ -233,8 +233,8 @@ wrap lim = Text.words .> wrap_ 0 .> Text.unwords where lw = Text.length w -str :: StringConv a b => a -> b -str = toS +str :: (StringConv a b) => a -> b +str = Protolude.Conv.toS tshow :: Show a => a -> Text tshow = show diff --git a/Biz/Bild.hs b/Biz/Bild.hs index 9868ef0..b00be40 100644 --- a/Biz/Bild.hs +++ b/Biz/Bild.hs @@ -19,13 +19,11 @@ -- -- * only input is one or more a namespaces. no subcommands, no packages -- --- * no need to write specific build rules +-- * no need to write specific build rules, one rule for hs, one for rs, one +-- for scm, and so on -- --- * one rule for hs, one for rs, one for scm, and so on --- --- * rules are written in Haskell as much as possible --- --- * no need to distinguish between exe and lib, just have a single output +-- * no need to distinguish between exe and lib, just have a single output, +-- or figure it out automatically -- -- * never concerned with deployment/packaging - leave that to another tool -- (scp? tar?) @@ -226,7 +224,7 @@ data Target = Target -- | We can't build everything yet... isBuildableNs :: Namespace -> Bool -isBuildableNs (Namespace _ Namespace.Hs) = True +isBuildableNs (Namespace (x : _) Namespace.Hs) | x /= "Hero" = True isBuildableNs (Namespace _ Namespace.Scm) = True isBuildableNs ns | ns `elem` nixTargets = True @@ -236,8 +234,7 @@ isBuildableNs ns [ Namespace ["Biz", "Pie"] Namespace.Nix, Namespace ["Biz", "Que", "Prod"] Namespace.Nix, Namespace ["Biz", "Cloud"] Namespace.Nix, - Namespace ["Biz", "Dev"] Namespace.Nix, - Namespace ["Hero", "Prod"] Namespace.Nix + Namespace ["Biz", "Dev"] Namespace.Nix ] -- | Emulate the *nix hierarchy in the cabdir. @@ -407,38 +404,40 @@ build andTest loud Target {..} = do ] GhcjsExe -> do Log.info ["bild", "dev", "ghcjs-exe", nschunk namespace] - proc - loud - namespace - "ghcjs" - [ "-Werror", - "-i" <> root, - "-odir", - root intdir, - "-hidir", - root intdir, - "--make", - path, - "-main-is", - Namespace.toHaskellModule namespace, - "-o", - root vardir Maybe.fromJust out - ] + pure Exit.ExitSuccess + --proc + -- loud + -- namespace + -- "ghcjs" + -- [ "-Werror", + -- "-i" <> root, + -- "-odir", + -- root intdir, + -- "-hidir", + -- root intdir, + -- "--make", + -- path, + -- "-main-is", + -- Namespace.toHaskellModule namespace, + -- "-o", + -- root vardir Maybe.fromJust out + -- ] GhcjsLib -> do Log.info ["bild", "dev", "ghcjs-lib", nschunk namespace] - proc - loud - namespace - "ghcjs" - [ "-Werror", - "-i" <> root, - "-odir", - root intdir, - "-hidir", - root intdir, - "--make", - path - ] + pure Exit.ExitSuccess + --proc + -- loud + -- namespace + -- "ghcjs" + -- [ "-Werror", + -- "-i" <> root, + -- "-odir", + -- root intdir, + -- "-hidir", + -- root intdir, + -- "--make", + -- path + -- ] Guile -> do Log.info ["bild", "dev", "guile", nschunk namespace] proc diff --git a/Biz/Bild.nix b/Biz/Bild.nix index 44c500a..bcb1940 100644 --- a/Biz/Bild.nix +++ b/Biz/Bild.nix @@ -3,7 +3,7 @@ with nixpkgs; let - ghcCompiler = "ghc865"; + ghcCompiler = "ghc884"; ghcjsCompiler = "ghcjs86"; # provided by .envrc @@ -26,7 +26,7 @@ let haskellDeps = hpkgs: import ./Bild/Deps/Haskell.nix hpkgs; mkGhcPackageSet = pkgs.haskell.packages.${ghcCompiler}.ghcWithHoogle; - mkGhcjsPackageSet = pkgs.haskell.packages.${ghcjsCompiler}.ghcWithPackages; + #mkGhcjsPackageSet = pkgs.haskell.packages.${ghcjsCompiler}.ghcWithPackages; in rec { # gather data needed for compiling by analyzing the main module @@ -87,30 +87,30 @@ in rec { installPhase = "exit 0"; } // { env = ghc; }; - ghcjs = main: - let - data = analyze main; - ghcjs = mkGhcjsPackageSet (hp: selectAttrs data.deps hp); - in stdenv.mkDerivation { - name = data.module; - src = ../.; - nativeBuildInputs = [ ghcjs ]; - strictDeps = true; - buildPhase = '' - mkdir -p $out/static - # compile with ghcjs - ${ghcjs}/bin/ghcjs \ - -Werror \ - -i. \ - --make ${main} \ - -main-is ${data.module} \ - -o ${data.out} - # optimize js output - ${pkgs.closurecompiler}/bin/closure-compiler \ - ${data.out}/all.js > $out/static/${data.out} - ''; - installPhase = "exit 0"; - } // { env = ghcjs; }; + #ghcjs = main: + # let + # data = analyze main; + # ghcjs = mkGhcjsPackageSet (hp: selectAttrs data.deps hp); + # in stdenv.mkDerivation { + # name = data.module; + # src = ../.; + # nativeBuildInputs = [ ghcjs ]; + # strictDeps = true; + # buildPhase = '' + # mkdir -p $out/static + # # compile with ghcjs + # ${ghcjs}/bin/ghcjs \ + # -Werror \ + # -i. \ + # --make ${main} \ + # -main-is ${data.module} \ + # -o ${data.out} + # # optimize js output + # ${pkgs.closurecompiler}/bin/closure-compiler \ + # ${data.out}/all.js > $out/static/${data.out} + # ''; + # installPhase = "exit 0"; + # } // { env = ghcjs; }; env = mkShell { name = "bizdev"; @@ -118,18 +118,17 @@ in rec { # haskell deps (mkGhcPackageSet haskellDeps) # ghcjs doesn't need everything, and many things fail to build - (mkGhcjsPackageSet (hp: with hp; [ - aeson - clay - containers - miso - protolude - servant - split - string-quote - text - ghcjs-base - ])) + #(mkGhcjsPackageSet (hp: with hp; [ + # aeson + # clay + # containers + # miso + # protolude + # servant + # split + # text + # ghcjs-base + #])) # python deps (nixpkgs.python38.withPackages (p: @@ -164,4 +163,6 @@ in rec { }; os = cfg: (nixos (args: cfg)).toplevel; + + sources = nixpkgs.sources; } diff --git a/Biz/Bild/Deps.nix b/Biz/Bild/Deps.nix index 9b62f7d..fd15d9e 100644 --- a/Biz/Bild/Deps.nix +++ b/Biz/Bild/Deps.nix @@ -5,11 +5,12 @@ let self.callCabal2nix name pkgs.sources.${name} {}; buildCabalSubdir = self: {name, src ? pkgs.sources.${name}, subdir ? name}: self.callCabal2nix name (src + "/${subdir}") {}; + ghc = "ghc884"; in rec { haskell = pkgs.haskell // { packages = pkgs.haskell.packages // { - ghc865 = pkgs.haskell.packages.ghc865.override (old: { + "${ghc}" = pkgs.haskell.packages."${ghc}".override (old: { overrides = with pkgs.pkgs.haskell.lib; self: super: pkgs.overridePinnedDeps (buildCabal self) // { acid-state = dontCheck super.acid-state; # mac: "too many open files" @@ -22,31 +23,31 @@ in rec wai-middleware-metrics = dontCheck super.wai-middleware-metrics; }; }); - ghcjs86 = pkgs.haskell.packages.ghcjs86.override (old: { - overrides = with pkgs.haskell.lib; self: super: - pkgs.overridePinnedDeps (buildCabal self) // { - Glob = dontCheck super.Glob; - QuickCheck = dontCheck super.QuickCheck; - aeson = dontCheck super.aeson; - base-compat-batteries = dontCheck super.base-compat-batteries; - clay = dontCheck super.clay; - comonad = dontCheck super.comonad; - ghcjs-base = dontCheck (buildCabal self "ghcjs-base"); - jsaddle-warp = dontCheck (buildCabalSubdir self { - name = "jsaddle-warp"; - src = pkgs.sources.jsaddle; - }); - http-types = dontCheck super.http-types; - network-uri= dontCheck super.network-uri; - scientific = dontCheck super.scientific; # takes forever - servant = dontCheck super.servant; - servant-auth = buildCabalSubdir self "servant-auth"; - tasty-quickcheck = dontCheck super.tasty-quickcheck; - temporary = dontCheck super.temporary; - time-compat = dontCheck super.time-compat; - vector = dontCheck super.vector; - }; - }); + #ghcjs86 = pkgs.haskell.packages.ghcjs86.override (old: { + # overrides = with pkgs.haskell.lib; self: super: + # pkgs.overridePinnedDeps (buildCabal self) // { + # Glob = dontCheck super.Glob; + # QuickCheck = dontCheck super.QuickCheck; + # aeson = dontCheck super.aeson; + # base-compat-batteries = dontCheck super.base-compat-batteries; + # clay = dontCheck super.clay; + # comonad = dontCheck super.comonad; + # ghcjs-base = dontCheck (buildCabal self "ghcjs-base"); + # jsaddle-warp = dontCheck (buildCabalSubdir self { + # name = "jsaddle-warp"; + # src = pkgs.sources.jsaddle; + # }); + # http-types = dontCheck super.http-types; + # network-uri= dontCheck super.network-uri; + # scientific = dontCheck super.scientific; # takes forever + # servant = dontCheck super.servant; + # servant-auth = buildCabalSubdir self "servant-auth"; + # tasty-quickcheck = dontCheck super.tasty-quickcheck; + # temporary = dontCheck super.temporary; + # time-compat = dontCheck super.time-compat; + # vector = dontCheck super.vector; + # }; + #}); }; }; diff --git a/Biz/Bild/Deps/Haskell.nix b/Biz/Bild/Deps/Haskell.nix index 4fd2d85..d2e6557 100644 --- a/Biz/Bild/Deps/Haskell.nix +++ b/Biz/Bild/Deps/Haskell.nix @@ -53,7 +53,6 @@ with hpkgs; servant-server split stm - string-quote stripe-haskell tasty tasty-hunit diff --git a/Biz/Bild/Deps/guile-opengl.nix b/Biz/Bild/Deps/guile-opengl.nix index d334430..34019d5 100644 --- a/Biz/Bild/Deps/guile-opengl.nix +++ b/Biz/Bild/Deps/guile-opengl.nix @@ -1,4 +1,5 @@ { stdenv +, lib , fetchurl , pkgconfig , guile @@ -29,7 +30,7 @@ in stdenv.mkDerivation { nativeBuildInputs = [ pkgconfig guile libGL libGLU freeglut ]; - meta = with stdenv.lib; { + meta = with lib; { description = "Guile bindings for the OpenGL graphics API"; homepage = "https://www.gnu.org/software/guile-opengl/"; license = licenses.gpl3Plus; diff --git a/Biz/Bild/Deps/inspekt3d.nix b/Biz/Bild/Deps/inspekt3d.nix index 2d76b0d..1093165 100644 --- a/Biz/Bild/Deps/inspekt3d.nix +++ b/Biz/Bild/Deps/inspekt3d.nix @@ -1,4 +1,5 @@ { stdenv +, lib , fetchFromGitHub , autoreconfHook , pkgconfig @@ -30,7 +31,7 @@ stdenv.mkDerivation { GUILE_AUTO_COMPILE = 0; preConfigure = "./bootstrap"; - meta = with stdenv.lib; { + meta = with lib; { description = "Lightweight 3D viewer for Libfive written in Guile Scheme"; homepage = "https://gitlab.com/kavalogic-inc/inspekt3d"; license = licenses.gpl3; diff --git a/Biz/Bild/Nixpkgs.nix b/Biz/Bild/Nixpkgs.nix index 262ec6f..6b442a0 100644 --- a/Biz/Bild/Nixpkgs.nix +++ b/Biz/Bild/Nixpkgs.nix @@ -29,5 +29,6 @@ import sources.nixpkgs { ]; config = { allowBroken = true; + allowUnfree = true; }; } diff --git a/Biz/Bild/Sources.json b/Biz/Bild/Sources.json index 1e01893..d2eac19 100644 --- a/Biz/Bild/Sources.json +++ b/Biz/Bild/Sources.json @@ -25,6 +25,18 @@ "url_template": "https://github.com///archive/.tar.gz", "version": "cc7729b1b42a79e261091ff7835f7fc2a7ae3cee" }, + "docopt": { + "branch": "monad-fail", + "description": "A command-line interface description language and parser that will make you smile", + "homepage": "http://docopt.org/", + "owner": "gelisam", + "repo": "docopt.hs", + "rev": "16dc7bc596c0ea4fa4466b12f474b1abfa72c885", + "sha256": "1m15zhm1b9sn7ihkxxavbgaihaybmpsrhx26pn1wyng9dh8vsp8b", + "type": "tarball", + "url": "https://github.com/gelisam/docopt.hs/archive/16dc7bc596c0ea4fa4466b12f474b1abfa72c885.tar.gz", + "url_template": "https://github.com///archive/.tar.gz" + }, "ghc-exactprint": { "branch": "master", "description": "GHC version of haskell-src-exts exactPrint", @@ -97,6 +109,15 @@ "url": "https://github.com/nmattia/niv/archive/af958e8057f345ee1aca714c1247ef3ba1c15f5e.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, + "nixos-mailserver": { + "repo": "https://gitlab.com/simple-nixos-mailserver/nixos-mailserver", + "rev": "5675b122a947b40e551438df6a623efad19fd2e7", + "sha256": "1fwhb7a5v9c98nzhf3dyqf3a5ianqh7k50zizj8v5nmj3blxw4pi", + "type": "tarball", + "url": "https://gitlab.com/simple-nixos-mailserver/nixos-mailserver/-/archive/5675b122a947b40e551438df6a623efad19fd2e7/nixos-mailserver-5675b122a947b40e551438df6a623efad19fd2e7.tar.gz", + "url_template": "https://gitlab.com/simple-nixos-mailserver/nixos-mailserver/-/archive//nixos-mailserver-.tar.gz", + "version": "2021-06-10-master" + }, "nixpkgs": { "branch": "biz", "description": "Nix Packages collection", @@ -104,10 +125,10 @@ "name": "nixpkgs", "owner": "simatime", "repo": "git://simatime.com/nixpkgs.git", - "rev": "da6c3c99661e0d8cd8d7ef6add6e181eed8e21d5", - "sha256": "1h3c2a8hpm4wmf0v61psb4m97frpdxvw29a9r1wrlcng0x9sak5h", + "rev": "fc19bcfcbf7d3a7511cccccacbe338abef57cc0a", + "sha256": "1zlisljka8hd9acrza6cf8n5izzw8g9qmv8hl3lzjdyhsavzi9rf", "type": "tarball", - "url": "https://simatime.com/archive/nixpkgs/biz/da6c3c99661e0d8cd8d7ef6add6e181eed8e21d5.tar.gz", + "url": "https://simatime.com/archive/nixpkgs/biz/fc19bcfcbf7d3a7511cccccacbe338abef57cc0a.tar.gz", "url_template": "https://simatime.com/archive///.tar.gz" }, "regex-applicative": { @@ -143,10 +164,11 @@ "homepage": null, "owner": "haskell-servant", "repo": "servant-auth", - "rev": "696fab268e21f3d757b231f0987201b539c52621", - "sha256": "1had0xyh511q7ggw2mlfhhk7pfbc30gqm2c9gj1y7pbflmsjgjda", + "rev": "servant-auth-0.4.0.0", + "sha256": "1wg67mr472mracyjd63ldlfiv85v2kdw2rvcvq1sahp05i591j26", "type": "tarball", - "url": "https://github.com/haskell-servant/servant-auth/archive/696fab268e21f3d757b231f0987201b539c52621.tar.gz", - "url_template": "https://github.com///archive/.tar.gz" + "url": "https://github.com/haskell-servant/servant-auth/archive/servant-auth-0.4.0.0.tar.gz", + "url_template": "https://github.com///archive/.tar.gz", + "version": "0.4.0.0" } } diff --git a/Biz/Bot.nix b/Biz/Bot.nix index 93aa2e6..f09279b 100644 --- a/Biz/Bot.nix +++ b/Biz/Bot.nix @@ -2,7 +2,7 @@ , lib , config , pkgs -, modulesPath +, ... }: let diff --git a/Biz/Cloud.nix b/Biz/Cloud.nix index 4730f1f..dc72fa9 100644 --- a/Biz/Cloud.nix +++ b/Biz/Cloud.nix @@ -3,10 +3,10 @@ # Cloud infrastructure, always online. Mostly for messaging-related stuff. let - nixos-mailserver = let ver = "v2.3.0"; in builtins.fetchTarball { - url = "https://gitlab.com/simple-nixos-mailserver/nixos-mailserver/-/archive/${ver}/nixos-mailserver-${ver}.tar.gz"; - sha256 = "0lpz08qviccvpfws2nm83n7m2r8add2wvfg9bljx9yxx8107r919"; - }; + #nixos-mailserver = let ver = "v2.3.0"; in builtins.fetchTarball { + # url = "https://gitlab.com/simple-nixos-mailserver/nixos-mailserver/-/archive/${ver}/nixos-mailserver-${ver}.tar.gz"; + # sha256 = "0lpz08qviccvpfws2nm83n7m2r8add2wvfg9bljx9yxx8107r919"; + #}; in bild.os { imports = [ @@ -20,7 +20,7 @@ bild.os { ./Cloud/Networking.nix ./Cloud/Web.nix ./Cloud/Znc.nix - nixos-mailserver + "${bild.sources.nixos-mailserver}" ]; networking.hostName = "simatime"; networking.domain = "simatime.com"; diff --git a/Biz/Cloud/Git.nix b/Biz/Cloud/Git.nix index fd7c8a2..bc9812c 100644 --- a/Biz/Cloud/Git.nix +++ b/Biz/Cloud/Git.nix @@ -36,6 +36,7 @@ in { # git group users.users = { gitDaemon = { + isSystemUser = true; description = "Git daemon user"; extraGroups = [ "git" ]; }; diff --git a/Biz/Dev/Configuration.nix b/Biz/Dev/Configuration.nix index caba05e..4539547 100644 --- a/Biz/Dev/Configuration.nix +++ b/Biz/Dev/Configuration.nix @@ -122,7 +122,7 @@ in { port = ports.hoogle; home = "//hoogle.simatime.com"; packages = import ../Bild/Deps/Haskell.nix; - haskellPackages = pkgs.haskell.packages.ghc865; + haskellPackages = pkgs.haskell.packages.ghc884; host = "0.0.0.0"; }; diff --git a/Biz/Devalloc.hs b/Biz/Devalloc.hs index 32fa7f9..b920241 100644 --- a/Biz/Devalloc.hs +++ b/Biz/Devalloc.hs @@ -73,7 +73,6 @@ import qualified Clay.Font import qualified Clay.Render as Clay import qualified Control.Concurrent.Async as Async import qualified Control.Exception as Exception -import Control.Monad ((>=>)) import Crypto.JOSE.JWK (JWK) import Data.Acid (makeAcidic) import qualified Data.Acid as Acid @@ -81,7 +80,7 @@ import qualified Data.Acid.Advanced as Acid import qualified Data.Acid.Local as Acid import qualified Data.Aeson as Aeson import qualified Data.ByteString.Lazy as LBS -import Data.Data (Data, Typeable) +import Data.Data (Data) import Data.IxSet (Indexable (..), IxSet, ixFun, ixSet, (&&&), (@=)) import qualified Data.IxSet as IxSet import qualified Data.List as List @@ -1018,7 +1017,7 @@ guardAdmin = \case requiredScopes :: Set Text requiredScopes = Set.fromList ["repo"] -guardScope :: Text -> Handler () +guardScope :: Text -> Servant.Handler () guardScope = Text.split (== ',') .> Set.fromList @@ -1052,7 +1051,7 @@ htmlApp cooks kp cfg jwk oAuthArgs = Just code -> do OAuthResponse {..} <- githubOauth oAuthArgs code |> liftIO guardScope scope - let warn :: Text -> Handler a + let warn :: Text -> Servant.Handler a warn msg = Log.warn [msg] >> Log.br @@ -1094,7 +1093,7 @@ htmlApp cooks kp cfg jwk oAuthArgs = (GitHub.currentUserReposR GitHub.RepoPublicityAll GitHub.FetchAll) |> liftIO +> \case - Left err -> throwError err502 {errBody = show err} + Left err -> throwError err502 {errBody = str <| (show err :: String)} Right repos -> pure <. App.Html <| SelectRepo user repos, getAnalyses = guardAuth @@ -1642,14 +1641,7 @@ analyze keep askedBy activeAuthors url bareRepo repoPrivate = do ] /> String.lines authors <- traverse (authorsFor bareRepo) tree :: IO [[(Text, Text, Text)]] - let authorMap = - zipWith - ( \path authors_ -> - (path, authors_) - ) - tree - authors :: - [(FilePath, [(Text, Text, Text)])] + let authorMap = zip tree authors :: [(FilePath, [(Text, Text, Text)])] stalenessMap <- traverse (lastTouched bareRepo) tree let blackholes = [ Text.pack path diff --git a/Biz/Devalloc.nix b/Biz/Devalloc.nix index 40b06c4..a1c9bcf 100644 --- a/Biz/Devalloc.nix +++ b/Biz/Devalloc.nix @@ -2,7 +2,7 @@ , lib , config , pkgs -, modulesPath +, ... }: let diff --git a/Biz/Que/Host.nix b/Biz/Que/Host.nix index 3514554..db2f748 100644 --- a/Biz/Que/Host.nix +++ b/Biz/Que/Host.nix @@ -2,7 +2,7 @@ , lib , config , pkgs -, modulesPath +, ... }: let diff --git a/Biz/Que/Site.nix b/Biz/Que/Site.nix index 0bf1613..15b058d 100644 --- a/Biz/Que/Site.nix +++ b/Biz/Que/Site.nix @@ -2,7 +2,7 @@ , lib , config , pkgs -, modulesPath +, ... }: diff --git a/Data/String/Quote.hs b/Data/String/Quote.hs new file mode 100644 index 0000000..7efe692 --- /dev/null +++ b/Data/String/Quote.hs @@ -0,0 +1,37 @@ +{-# LANGUAGE TemplateHaskell #-} + +-- | QuasiQuoter for non-interpolated strings, texts and bytestrings. +-- +-- Originally by Audrey Tang +-- +-- The "s" quoter contains a multi-line string with no interpolation at all: +-- +-- @ +-- {-\# LANGUAGE QuasiQuotes #-} +-- import Data.Text (Text) +-- import Data.String.Quote +-- foo :: Text -- "String", "ByteString" etc also works +-- foo = [s| +-- +-- Well here is a +-- multi-line string! +-- +-- |] +-- @ +-- +-- Any instance of the IsString type is permitted. +module Data.String.Quote (s) where + +import Alpha +import GHC.Exts (IsString (..)) +import qualified Language.Haskell.TH as TH +import Language.Haskell.TH.Quote + +-- | QuasiQuoter for a non-interpolating IsString literal. The pattern portion is undefined. +s :: QuasiQuoter +s = + QuasiQuoter + ((\a -> [|fromString a|]) <. filter (/= '\r')) + (error "Cannot use q as a pattern") + (error "Cannot use q as a type") + (error "Cannot use q as a dec") diff --git a/Hero/Host.hs b/Hero/Host.hs index 3f6df8e..6313ae5 100644 --- a/Hero/Host.hs +++ b/Hero/Host.hs @@ -37,7 +37,6 @@ -- : dep servant-lucid -- : dep servant-server -- : dep split --- : dep string-quote -- : dep tasty -- : dep tasty-hunit -- : dep tasty-quickcheck diff --git a/Hero/Node.hs b/Hero/Node.hs index a453a01..5511942 100644 --- a/Hero/Node.hs +++ b/Hero/Node.hs @@ -14,7 +14,6 @@ -- : dep protolude -- : dep servant -- : dep split --- : dep string-quote -- : dep text -- : dep ghcjs-base module Hero.Node where diff --git a/Hero/Service.nix b/Hero/Service.nix index d06b567..906d98e 100644 --- a/Hero/Service.nix +++ b/Hero/Service.nix @@ -2,7 +2,7 @@ , lib , config , pkgs -, modulesPath +, ... }: let -- cgit v1.2.3