Skip to content

Commit d3bc7df

Browse files
committed
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.
1 parent 84a2606 commit d3bc7df

File tree

4 files changed

+52
-0
lines changed

4 files changed

+52
-0
lines changed

test/default.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ let
221221
cabal-project-nix-path = callTest ./cabal-project-nix-path {};
222222
plugin = callTest ./plugin {};
223223
supported-languages = callTest ./supported-langauges {};
224+
js-template-haskell = callTest ./js-template-haskell {};
224225
unit = unitTests;
225226
};
226227

test/js-template-haskell/default.nix

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Test building TH code that needs DLLs when cross compiling for windows
2+
{ stdenv, lib, project', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name, ... }:
3+
4+
with lib;
5+
6+
let
7+
project = project' {
8+
inherit compiler-nix-name;
9+
src = testSrc "js-template-haskell";
10+
modules = [
11+
# Fix node: createProcess: posix_spawnp: does not exist (No such file or directory)
12+
# ({ pkgs,... }: {
13+
# packages.js-template-haskell.components.library.build-tools = [ pkgs.pkgsBuildHost.nodejs ];
14+
# })
15+
];
16+
};
17+
18+
packages = project.hsPkgs;
19+
20+
in recurseIntoAttrs {
21+
ifdInputs = {
22+
inherit (project) plan-nix;
23+
};
24+
25+
build = packages.js-template-haskell.components.library;
26+
build-profiled = packages.js-template-haskell.components.library.profiled;
27+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
cabal-version: 3.0
2+
name: js-template-haskell
3+
version: 0.1.0.0
4+
category: Repro
5+
build-type: Simple
6+
7+
common warnings
8+
ghc-options: -Wall
9+
10+
library
11+
import: warnings
12+
exposed-modules: MyLib
13+
build-depends: base ^>=4.19.1.0
14+
, uri-bytestring
15+
hs-source-dirs: src
16+
default-language: Haskell2010

test/js-template-haskell/src/MyLib.hs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{-# LANGUAGE QuasiQuotes #-}
2+
3+
module MyLib (someFunc) where
4+
5+
import URI.ByteString.QQ
6+
7+
someFunc :: IO ()
8+
someFunc = putStrLn $ show [uri|https://www.example.com/|]

0 commit comments

Comments
 (0)