From d3bc7df435bc9cb6126da5fe2fea92fb790f9d9f Mon Sep 17 00:00:00 2001 From: Samuel Evans-Powell Date: Sat, 11 May 2024 22:19:01 +0800 Subject: [PATCH 1/2] Add reproduction case for failing quasiquoting when using JS backend - The JS backend is failing with ghc-9.8.2 due to missing "nodejs" executable and "ghci" package. - Uncommenting the code in "modules" of "test/js-template-haskell/default.nix" will fix the nodejs issue. - Unsure how to fix the "ghci" issue. --- test/default.nix | 1 + test/js-template-haskell/default.nix | 27 +++++++++++++++++++ .../js-template-haskell.cabal | 16 +++++++++++ test/js-template-haskell/src/MyLib.hs | 8 ++++++ 4 files changed, 52 insertions(+) create mode 100644 test/js-template-haskell/default.nix create mode 100644 test/js-template-haskell/js-template-haskell.cabal create mode 100644 test/js-template-haskell/src/MyLib.hs diff --git a/test/default.nix b/test/default.nix index abccf8f7b3..066d3a5aad 100644 --- a/test/default.nix +++ b/test/default.nix @@ -221,6 +221,7 @@ let cabal-project-nix-path = callTest ./cabal-project-nix-path {}; plugin = callTest ./plugin {}; supported-languages = callTest ./supported-langauges {}; + js-template-haskell = callTest ./js-template-haskell {}; unit = unitTests; }; diff --git a/test/js-template-haskell/default.nix b/test/js-template-haskell/default.nix new file mode 100644 index 0000000000..03bf9c48f7 --- /dev/null +++ b/test/js-template-haskell/default.nix @@ -0,0 +1,27 @@ +# Test building TH code that needs DLLs when cross compiling for windows +{ stdenv, lib, project', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name, ... }: + +with lib; + +let + project = project' { + inherit compiler-nix-name; + src = testSrc "js-template-haskell"; + modules = [ + # Fix node: createProcess: posix_spawnp: does not exist (No such file or directory) + # ({ pkgs,... }: { + # packages.js-template-haskell.components.library.build-tools = [ pkgs.pkgsBuildHost.nodejs ]; + # }) + ]; + }; + + packages = project.hsPkgs; + +in recurseIntoAttrs { + ifdInputs = { + inherit (project) plan-nix; + }; + + build = packages.js-template-haskell.components.library; + build-profiled = packages.js-template-haskell.components.library.profiled; +} diff --git a/test/js-template-haskell/js-template-haskell.cabal b/test/js-template-haskell/js-template-haskell.cabal new file mode 100644 index 0000000000..9f9ef76d90 --- /dev/null +++ b/test/js-template-haskell/js-template-haskell.cabal @@ -0,0 +1,16 @@ +cabal-version: 3.0 +name: js-template-haskell +version: 0.1.0.0 +category: Repro +build-type: Simple + +common warnings + ghc-options: -Wall + +library + import: warnings + exposed-modules: MyLib + build-depends: base ^>=4.19.1.0 + , uri-bytestring + hs-source-dirs: src + default-language: Haskell2010 diff --git a/test/js-template-haskell/src/MyLib.hs b/test/js-template-haskell/src/MyLib.hs new file mode 100644 index 0000000000..564b5e992d --- /dev/null +++ b/test/js-template-haskell/src/MyLib.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE QuasiQuotes #-} + +module MyLib (someFunc) where + +import URI.ByteString.QQ + +someFunc :: IO () +someFunc = putStrLn $ show [uri|https://www.example.com/|] From 617e50e0412b5b3075e430a754b58c02506e9286 Mon Sep 17 00:00:00 2001 From: Samuel Evans-Powell Date: Sun, 12 May 2024 08:56:16 +0800 Subject: [PATCH 2/2] Remove unnecesary base constraint --- test/js-template-haskell/js-template-haskell.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/js-template-haskell/js-template-haskell.cabal b/test/js-template-haskell/js-template-haskell.cabal index 9f9ef76d90..26d6878c91 100644 --- a/test/js-template-haskell/js-template-haskell.cabal +++ b/test/js-template-haskell/js-template-haskell.cabal @@ -10,7 +10,7 @@ common warnings library import: warnings exposed-modules: MyLib - build-depends: base ^>=4.19.1.0 + build-depends: base , uri-bytestring hs-source-dirs: src default-language: Haskell2010