haskell-stack

upgrading the ghc version being used by haskell stack

好久不见. 提交于 2019-12-19 09:04:18
问题 I'm trying to update my ghc version installed for haskell stack from version 8.0.2 to 8.2.1 but seems like I am missing something. [user@localhost ~]$ stack --resolver ghc-8.2.1 setup stack will use a sandboxed GHC it installed For more information on paths, see 'stack path' and 'stack exec env' To use this GHC and packages outside of a project, consider using: stack ghc, stack ghci, stack runghc, or stack exec [user@localhost ~]$ stack ghci Configuring GHCi with the following packages: GHCi,

Profiling builds with Stack

我与影子孤独终老i 提交于 2019-12-18 09:59:50
问题 How do I tell stack to build my executable and all its dependencies with -prof ? Simply adding it to ghc-options in the .cabal file is not enough, because it only tries to build the executable with profiling enabled, which fails. 回答1: Profiling builds with Stack 1.0.0 and newer To build with profiling enabled: stack build --profile You may need to run stack clean first , but this should be fixed in Stack 1.5.0. To profile: stack exec --profile -- <your program> +RTS <profiling options> where

Stack build fails due to missing package although stack ghci works

北慕城南 提交于 2019-12-17 20:41:20
问题 I am trying to build a simple program in Haskell using stack. I created a new project using stack new and did a stack setup after that. The template builds fine. I want to experiment with binary file parsing, so I imported Data.ByteString . My build-depends in the cabal file look like this: build-depends: base >= 4.7 && < 5 , bytestring >= 0.10.6 , binary >= 0.7.5 stack ghci now just works, but stack build is still not happy. Can someone tell me what I did wrong here? Here is the complete

How to use “-ddump-minimal-imports” with stack

对着背影说爱祢 提交于 2019-12-13 11:43:36
问题 I am such a big fan of stack, that I've removed any independent cabal and ghc executables completely from my machine (letting stack install whatever it needs in its own mysterious ~/.stack/ directory).... However, it looks like some flags aren't working properly under stack. For instance, I want to use -ddump-minimal-imports . In cabal this would be cabal build --ghc-option=-ddump-minimal-imports The obvious translation would be stack build --ghc-options -ddump-minimal-imports This runs, but

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

笑着哭i 提交于 2019-12-13 03:18:58
问题 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? 回答1: First thing you have to do is to get your package into nightly. For this, you open a PR on the fpco/stackage GitHub project. It is recommended to follow the given template and make sure all checkboxes are ticked (that is, you tested that the package works locally with the latest nightly). Once the PR is

Stack test output garbled on MINGW64

柔情痞子 提交于 2019-12-13 00:33:00
问题 I'm running GHC using Stack on Windows 10, and using Git Bash (MINGW64) for much of my daily workflow. That includes using GHC and GHCi, which generally works fine. However, when I run stack test from MINGW64, the output is garbled by ANSI color codes: $ stack test UC-0.1.0.0: test (suite: UC-test) [?25lSorting Group 1: [2K[1F prop1: [[92mOK, passed 100 tests[0m] [2K[1F prop2: [[92mOK, passed 100 tests[0m] Properties Total Passed [92m2[0m [92m2[0m Failed 0 0 Total [92m2[0m [92m2[0m [?25h

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

妖精的绣舞 提交于 2019-12-12 22:36:01
问题 In a Haskell project's cabal file we have the following sections: C-Sources: src/A.c , src/B.c , ... Includes: include/A.h , include/B.h , ... Unfortunately, wildcarding in these sections is not allowed (as confirmed here): -- this doesn't work: C-Sources: src/*.c Includes: include/*.h Question: How can one alter Setup.hs to automatically include src/*.c and include/*.h as above? 来源: https://stackoverflow.com/questions/41575528/how-to-automatically-include-haskell-c-sources-through-setup-hs

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

夙愿已清 提交于 2019-12-12 08:47:37
问题 Suppose one is using the stack build 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 libraries from hackage), is there a way to use stack to export your Lib.o , Lib.hi , and Lib_stub.h to be consumed by a C/C++ compiler like gcc or g++ ? EDIT: A related question might be: "how can one use Stack as a build tool to be used with a Haskell

Do I need Setup.hs file when creating Haskell projects?

99封情书 提交于 2019-12-12 05:36:46
问题 I use stack new <name> , then hpack-convert and add dependencies into package.yaml in order to skip ceremony and start writing Haskell code. Why is there's always a Setup.hs file? I don't use custom setups as far as I know. Will I need to include this file at some point? 回答1: I think it's just an old haskell convention that "Setup.hs" can be used to build the package, even for simple build types. Pretty sure it can be removed without having issues. 来源: https://stackoverflow.com/questions

How to use stack bench

醉酒当歌 提交于 2019-12-11 13:46:02
问题 I've been playing around with using stack for a little haskell application, so far I have been able to build and test fine and was interested in looking at performance so tried stack bench however this is all that seems to happen: c:\Users\jk\projects\foo>stack bench stack bench I don't think it can have done anything? My application does not appear to have run. Presuembly there is some configuration I am missing? 回答1: stack bench will run any benchmark suites defined in your foo.cabal file.