cabal

What is the relationship between ghc-pkg and cabal?

六月ゝ 毕业季﹏ 提交于 2019-12-03 04:46:02
问题 With respect to how packages are created, installed and used in Haskell, what is the relationship between ghc-pkg and cabal? What are their roles - when would you use one, over the other, or use both? Are they complementary tools, competitive tools, or simply tools that do different jobs? 回答1: Graphically, the dependencies are: Packages GHC can use | Are registered with "ghc-pkg register" | And (almost always) built with Cabal | With build dependencies resolved by cabal-install | From Hackage

Haskell Stack install package dependency from github

扶醉桌前 提交于 2019-12-03 04:14:25
问题 Is it possible to install a version of a package from github using Haskell stack? e.g. in a .cabal or a stack.yaml file, how can I point a dependency at a git repo/branch/revision? 回答1: The documentation for the stack.yaml packages section gives examples of referring to more complex package locations. packages: - location: . - location: dir1/dir2 - location: https://example.com/foo/bar/baz-0.0.2.tar.gz - location: http://github.com/yesodweb/wai/archive/2f8a8e1b771829f4a8a77c0111352ce45a14c30f

Current state of integrating unit tests with Haskell's Cabal?

ぃ、小莉子 提交于 2019-12-03 03:45:33
问题 When i google for how to integrate unit tests with cabal files, i either find http://www.haskell.org/haskellwiki/How_to_write_a_Haskell_program which does not seem to describe the integration of HUnit/QuickCheck with the Cabal file or i see messages like "wait for Cabal x.y which will support cabal test" but i can not find any documentation for this either How would you run all unit test using cabal (for example everytime i do a "cabal build") today? 回答1: Make sure you have the latest version

Haskell Stack Ghci test-suite

做~自己de王妃 提交于 2019-12-03 02:27:30
I'm trying to use stack to load my test-suite in ghci and have it load the QuickCheck and hspec dependency. How can I do this? I'm using the franklinchen template. https://github.com/commercialhaskell/stack-templates/blob/master/franklinchen.hsfiles I have tried stack ghci spec stack ghci test-suite stack ghci --main-is spec I modified the test-suite spec to target the main-is: LibSpec.hs file test-suite spec default-language: Haskell2010 ghc-options: -Wall type: exitcode-stdio-1.0 hs-source-dirs: test main-is: LibSpec.hs build-depends: base , chapterexercises , hspec , QuickCheck stack ghci -

Cabal - Expose all modules while building library

我们两清 提交于 2019-12-03 01:33:24
Is it possible to tell Cabal to expose all modules while building a library? Right now I have to provide very long list of modules in the Exposed-modules cabal configurtion file section. The modern answer is stack + hpack instead of using explicit cabal config. It could automatically expose package modules and provides many other enhancements. You have to list all modules in the cabal configuration file. In your case, you just put the list of modules after exposed-module: . There is no simpler way to write a list of modules. Cabal cannot automatically find the files that are part of an

Producing multiple executables from single project

元气小坏坏 提交于 2019-12-03 00:09:44
With the following project structure: src/FirstExecutable.hs src/SecondExecutable.hs my-amazing-project.cabal and the following cabal setup: name: my-amazing-project version: 0.1.0.0 build-type: Simple cabal-version: >=1.8 executable first-executable hs-source-dirs: src main-is: FirstExecutable.hs ghc-options: -O2 -threaded -with-rtsopts=-N build-depends: base == 4.5.* executable second-executable hs-source-dirs: src main-is: SecondExecutable.hs ghc-options: -O2 -threaded -with-rtsopts=-N build-depends: base == 4.5.* Running cabal install fails with the following output: Installing executable

SBT-like features in the Haskell build ecosystem

邮差的信 提交于 2019-12-02 21:25:43
I've been using Scala with SBT quite a bit lately. The REPL loop of has a handy feature: ~ COMMAND , meaning perform COMMAND for every source file change in the project. For instance: ~ test and ~ compile are terrifically useful for rapid development. I wonder, does anyone know of something similar for Haskell, a cabal shell, maybe? You can get something like this very easily using inotifywait . Just fire up a terminal in your project directory and run something like this: $ while inotifywait -qq -r -e modify .; do cabal build && ./dist/build/tests/tests; done This also works for any other

Control.Monad.State found in multiple packages haskell

丶灬走出姿态 提交于 2019-12-02 18:13:36
While evaluating the line "import Control.Monad.State" in a Haskell module, GHC gives me the following error: Could not find module `Control.Monad.State': it was found in multiple packages: monads-fd-0.0.0.1 mtl-1.1.0.2 Failed, modules loaded: none. How do I resolve this conflict? Reid Barton You have several options. Either: ghc-pkg hide monads-fd . This will cause GHC and GHCi to ignore the presence of the monads-fd by default until you later ghc-pkg expose monads-fd , but software installed by Cabal will still be able to build against it. Use the {-# LANGUAGE PackageImports #-} pragma, and

What is the relationship between ghc-pkg and cabal?

泄露秘密 提交于 2019-12-02 17:57:45
With respect to how packages are created, installed and used in Haskell, what is the relationship between ghc-pkg and cabal ? What are their roles - when would you use one, over the other, or use both? Are they complementary tools, competitive tools, or simply tools that do different jobs? Graphically, the dependencies are: Packages GHC can use | Are registered with "ghc-pkg register" | And (almost always) built with Cabal | With build dependencies resolved by cabal-install | From Hackage. ghc-pkg is a direct interface to GHC's package database. Cabal is a tool that provides a consistent