Questions tagged [haskell-stack]

Questions about the Stack, a build tool for the Haskell language. Do not use this tag for general Haskell questions that do not involve Stack.

stack is a modern, cross-platform build tool for Haskell code. It covers management of Haskell environment and project dependencies, building, testing and benchmarking.

1268 questions
8
votes
2 answers

Haskell Stack `exec` executable not found despite path being searched

Creating a fresh haskell-stack project fails to find the project-exec executable, despite searching the appropriate path. I'm not sure why. In particular, stack build creates the project-exec inside…
clo_jur
  • 1,359
  • 1
  • 11
  • 27
8
votes
1 answer

How to Use Haskell's Stack Build Tool to Export a Library to Be Consumed by C/C++?

Suppose one is using the stackbuild tool to make a Haskell library (importing packages from Hackage, and so forth) to be used with a C/C++ project in which main is located in C/C++. Supposing your project is named Lib.hs (which uses external…
George
  • 6,927
  • 4
  • 34
  • 67
8
votes
0 answers

What state is stored between running 'stack build' vs 'stack build --profile' or similarly changing ghc options?

If I run stack clean && stack build --profile, I get an executable that is slower than if I had run stack clean && stack build, this is normal and fine. If I run stack clean && stack build --profile && stack build then I get an executable that is…
user224969
8
votes
1 answer

Best practices for distributing a Haskell application and updating it

tl;dr About a week ago I released the 0.1.0.0 package for my first non-trivial Haskell project. I want the executable to be easy to install and upgrade, even for non-Haskellers. In the README, I suggested installing using cabal install. Is this a…
Greg Hurrell
  • 5,177
  • 23
  • 27
8
votes
1 answer

Can I ask GHC to import Debug.Trace for every module during development?

The title is pretty self-explanatory. I often add traces when debugging, which requires adding the Debug.Trace import. However, I equally often forget about removing those when I'm done. What I'd like would be a "dev" switch which would add the…
Bartek Banachewicz
  • 38,596
  • 7
  • 91
  • 135
8
votes
1 answer

Haskell Stack build specific executable

How to build an specific stack executable file, ie. those specified in projectname.cabal, like: executable executable-name hs-source-dirs: tools main-is: ExecutableModule.hs ghc-options: -Wall -threaded -rtsopts…
EliuX
  • 11,389
  • 6
  • 45
  • 40
8
votes
1 answer

GHC Linker error (stack)

I'm somewhat of a beginner in Haskell and I'm trying out stack to build an application. However, stack build gives me linker errors when executed: Linking .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/sim-exe/sim-exe…
DeX3
  • 5,200
  • 6
  • 44
  • 68
7
votes
1 answer

ghc-pkg: Couldn't open database for modification: hLock: invalid argument

I'm trying to compile the behead.hs script from the pandoc tutorial on Ubuntu 20.04 (WSL1). I can successfully compile it with stack exec -- ghc behead.hs or stack --resolver lts-16.25 exec -- ghc behead.hs but that uses pandoc-types-1.20 and I need…
peer
  • 4,171
  • 8
  • 42
  • 73
7
votes
0 answers

How to cross-compile a binary for a Raspberry Pi written in Haskell in Ubuntu Linux?

In the past I have compiled binaries for different architectures on an x86_x64 with the resulting target binary generated for a different architecture; For instance the target binary might be for something like an IA64 or an ARM processor using…
leeand00
  • 25,510
  • 39
  • 140
  • 297
7
votes
1 answer

Can docker solve a problem of mismatched C shared libraries?

I am trying to run some haskell code on an ubuntu (18.04) host, which was compiled on my laptop. host: 4.15.0-36-generic #39-Ubuntu SMP Mon Sep 24 16:19:09 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux laptop: 4.14.74-1-MANJARO #1 SMP PREEMPT Fri Oct 5…
ocstat
  • 189
  • 3
  • 8
7
votes
1 answer

Is it possible to specify a `stack.yaml` file for a haskell script?

Let's say I have the following script inside my haskell project directory: #!/usr/bin/env stack -- stack --resolver lts-12.5 script -- some imports here main :: IO () main = do -- some code here I'd like to use the stack.yaml file that exists…
Gaith
  • 798
  • 8
  • 19
7
votes
3 answers

stack install ghc-mod fails with dependencies conflicts on OSX 10.13.4

When I try to install ghc-mod via stack I end up having these depencies conflicts Error: While constructing the build plan, the following exceptions were encountered: In the dependencies for ghc-mod-5.8.0.0: Cabal-2.0.1.1 from stack…
Mo Hajr
  • 1,253
  • 1
  • 15
  • 31
7
votes
1 answer

stack build results in "output was redirected with -o, but no output will be generated because there is no Main module."

Didn't see any relevant result when google searching for this error so thought I'd post it. stack build Building all executables for `gitchapter' once. After a successful build of all of them, only specified executables will be…
Chris Stryczynski
  • 30,145
  • 48
  • 175
  • 286
7
votes
1 answer

Stack: Compile stand-alone source file

Once you've installed Stack, you can use it to install GHC for you. Great! ...now how do I compile a file with it? To be clear: What you're supposed to do is write a package specification and have Stack build that. But surely there must be a way to…
MathematicalOrchid
  • 61,854
  • 19
  • 123
  • 220
7
votes
1 answer

Configure stack ghci prompt

Is it possible to configure stack ghci similar to the way ghci is configured via the ~/.ghci file? Currently stack ghci does not pick up the settings in the ~/.ghci file. I'm looking into setting the prompt to be a lambda instead of the loaded…
Răzvan Flavius Panda
  • 21,730
  • 17
  • 111
  • 169