Ghc-wasm-cabal Issues

I’ve been working on a project, and I’ve recently hit a devops-ish kind of issue: after getting ghc-wasm through nix flakes, I’m trying to compile the project by: wasm32-wasi-cabal build WASM --flags="wasm", but I get errors building happy and th-orphans.

happy error:

Configuring executable 'happy' for happy-1.20.1.1...
Preprocessing executable 'happy' for happy-1.20.1.1...
Building executable 'happy' for happy-1.20.1.1...
wasm32-wasi-ghc-9.6.4: could not execute: /nix/store/70jynsvi21a9lm46n82yvvqfh15fdlra-wasm32-wasi-ghc-9.6/lib/wasm32-wasi-ghc-9.6.4/lib/bin/unlit

th-orphans error:

Configuring library for th-orphans-0.13.14...
Preprocessing library for th-orphans-0.13.14...
Building library for th-orphans-0.13.14...
[1 of 2] Compiling Language.Haskell.TH.Instances.Internal ( src/Language/Haskell/TH/Instances/Internal.hs, dist/build/Language/Haskell/TH/Instances/Internal.o )
[2 of 2] Compiling Language.Haskell.TH.Instances ( src/Language/Haskell/TH/Instances.hs, dist/build/Language/Haskell/TH/Instances.o )

<no location info>: error:
    Couldn't find a target code interpreter. Try with -fexternal-interpreter

Regarding the happy error, although there is no unlit executable in that folder, there is one called wasm32-wasi-unlit, so I believe some sort of symlink can solve this, but I have no idea on how to include this in the flakes.nix file.

Regarding the th-orphans error, I’m totally clueless.

P.D: don’t mind too much about stack in the flakes, it’s there because I wanted to make sure that the other executable compiles normally.

I don’t think the wasm backend supports Template Haskell yet.

1 Like

That’s too bad :frowning: , do you happen to know a workaround to this?

I can expand all the TH definitions in my project, but I’m not too sure If I’ll be able to dismiss all the dependencies that uses TH