天道酬勤,学无止境

haskell-stack

Breaking down stages of Haskell Stack builds

I'm trying to separate the stages of building my package and its dependencies in a sequence of uses of stack build but have become a bit disoriented by all the combinations of flags that seem relevant. My goal is to separately: Build package dependencies only Build testing dependencies only Build the package, only Run tests (with everything already built) stack --resolver XXX build --no-run-tests--no-run-benchmarks --only-dependencies stack --resolver XXX build --no-run-tests --no-run-benchmarks stack --resolver XXX build --no-run-tests --no-run-benchmarks --test --bench stack --resolver XXX

2022-05-02 21:34:59    分类:问答    haskell   haskell-stack

Where should caching occur in a GitHub Action?

What is the correct placement of caching in a GitHub Action? Specifically is in correct to place it before or after running setup of tools using another Action? For example if I'm using something like haskell/actions/setup should my use of actions/cache precede or follow that? Put another way: if setup subsequently installs updated components on a future run of my Action, will the corresponding parts of the cache be invalidated?

2022-05-02 16:34:16    分类:问答    caching   github-actions   haskell-stack

Compile stack script instead of running it

The build tool stack has the feature to treat a usually compiled haskell source file as a script. (https://docs.haskellstack.org/en/stable/GUIDE/#script-interpreter) Is it also possible to create a compiled executable the same way? I searched the help section of stack and stack script, but could not find an options that make this possible. script.hs: #!/usr/bin/env stack {- stack script --resolver lts-13.14 --package turtle -} main = print "hello" So if given it the right permissions, this file can be executed. I guess behind the scenes stack compiles the file and then just runs it. And I'd

2022-04-30 20:08:34    分类:问答    haskell   haskell-stack

Why doesn't my Haskell program run in Docker with Alpine or Scratch?

I'm having a few issues try to build a Docker container that runs one Haskell application indefinitely. For starters, I'd like to use a base image that provides a program I need to use from my code. It is based on scratch linux. However, when I build my Haskell program and copy it to that container, I get an error: standard_init_linux.go:211: exec user process caused "no such file or directory" Next, I would like to keep my build process, and file structure very simple if possible. I have just one script in Haskell in Main.hs and it has one dependency on process. If it's possible and

2022-04-30 04:54:27    分类:问答    docker   haskell   haskell-stack

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 rebuilt. gitchapter-0.1.0.0: build (exe) Preprocessing executable 'app' for gitchapter-0.1.0.0.. Building executable 'app' for gitchapter-0.1.0.0.. Preprocessing executable 'test' for gitchapter-0.1.0.0.. Warning: Enabling workaround for Main module 'Main' listed in 'other-modules' Building executable 'test' for gitchapter-0.1.0.0.. illegaly! <no location info>: error

2022-04-29 17:11:19    分类:问答    haskell   cabal   haskell-stack

How to automatically include Haskell C-sources through `Setup.hs` build script?

问题 在 Haskell 项目的 cabal 文件中,我们有以下部分: C-Sources: src/A.c , src/B.c , ... Includes: include/A.h , include/B.h , ... 不幸的是,这些部分中不允许使用通配符(如在此处确认): -- this doesn't work: C-Sources: src/*.c Includes: include/*.h 问题:如何改变Setup.hs以自动包含src/*.c和include/*.h如上所述?

2022-04-29 12:13:04    分类:技术分享    haskell   cabal   haskell-stack

How to add documentation after packages have already been installed?

问题 我已经在快照数据库中安装了一堆包。 我现在想要一份他们文档的本地副本(如果它带有超链接源就更好了)。 有没有办法告诉stack在所有这些上运行haddock ? 编辑(从我的回答中复制): 貌似明显stack haddock package会为包安装haddock,所以 $ cd ~/.stack/snapshots/x86_64-linux/lts-3.0/7.10.2/doc $ stack haddock * 似乎做我想做的事,有两个缺点: 我仍然需要记住将--haddock标志传递给每个build (没有~/.stack/config文件,是吗?) 似乎要重建它们; 有没有办法避免这种情况? 回答1 貌似明显stack haddock package会为包安装haddock,所以 $ cd ~/.stack/snapshots/x86_64-linux/lts-3.0/7.10.2/doc $ stack haddock * 似乎做我想做的事,有两个缺点: 我仍然需要记住将--haddock标志传递给每个build (没有~/.stack/config文件,是吗?) 似乎要重建它们; 有没有办法避免这种情况? 回答2 步骤 1. 下载并构建最新的黑线鳕。 构建说明在README.md中。 git clone https://github.com/haskell

2022-04-22 02:08:29    分类:技术分享    haskell   haskell-stack

Why doesn't stack add packages to the ghc package database?

问题 回答1 Stack 从不接触全局包数据库。 它使用分层数据库方法 全球数据库 - 未受影响堆栈快照中的包被安装到快照数据库中每个项目在本地安装其他包 因此,大多数包都安装在快照数据库中,而不是污染全局数据库,因此可以共享大多数包。 由于堆栈快照中的包是兼容的(即总是一起编译),我们不会遇到Cabal hell 。 您可以使用stack ghci或stack ghc在配置了包数据库的情况下运行相应的命令。 更准确的解释在堆栈 wiki

2022-04-21 12:37:03    分类:技术分享    haskell   ghc   stackage   haskell-stack

How to make a package appear into a future stack LTS snapshot again?

Sometimes certain packages get outdated, and they are not included subsequent stack LTS's snapshots. Is there a standard procedure to have these packages back into a future snapshot?

2022-04-17 11:30:43    分类:问答    haskell-stack

“Unable to load package `regex-posix` … unknown symbol ‘regerror’”

For a new project, I have been trying to build the threepenny-gui package, something which I have done many times in the past without any trouble. This time however, I ran into an unusual error message: > stack build threepenny-gui > configure threepenny-gui > Configuring threepenny-gui-0.9.0.0... threepenny-gui > build threepenny-gui > Preprocessing library for threepenny-gui-0.9.0.0.. threepenny-gui > Building library for threepenny-gui-0.9.0.0.. threepenny-gui > [ 1 of 29] Compiling Foreign.JavaScript.Include threepenny-gui > [ 2 of 29] Compiling Foreign.JavaScript.Resources threepenny-gui

2022-04-05 09:38:58    分类:问答    haskell   ghc   haskell-stack   threepenny-gui