[Haskell-beginners] Problem using stack

Robert Weisser Robert.Weisser at gmx.com
Tue Jan 19 16:54:31 UTC 2016


I recently installed stack via Haskell for Mac OS X
(https://ghcformacosx.github.io/), which gave me stack 0.1.8.0 x86_64 and ghc
7.10.2.

Following the User Guide (http://docs.haskellstack.org/en/stable/GUIDE.html),
I tried to create the first example (hello world, naturally).  Everything went
according to plan until I entered 'stack test', which failed.  The output was
supposed to be, 'Test suite not yet implemented.'  I tried to find information
online, but was unsuccessful.  I play with Haskell for fun and know nothing
about cabal, so I don't know if it is a cabal issue.

The error message includes 'helloworld-test:  executable not found'.
helloworld-test is indeed missing.  I searched for it using find:

  find . -name '*test'

Here is the terminal session, followed by the contents of the generated
helloworld.cabal file (with some user info removed):

$ stack new helloworld new-template
Downloading template "new-template" to create project "helloworld" in helloworld/ ...
Writing default config file to: /Users/rpw/self/haskell/stack/user_guide/helloworld/stack.yaml
Basing on cabal files:
- /Users/rpw/self/haskell/stack/user_guide/helloworld/helloworld.cabal

Checking against build plan lts-3.13
Selected resolver: lts-3.13
Wrote project config to: /Users/rpw/self/haskell/stack/user_guide/helloworld/stack.yaml

$ cd helloworld/

$ stack setup
stack will use the GHC on your PATH
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

$ stack build
helloworld-0.1.0.0: configure
Configuring helloworld-0.1.0.0...
helloworld-0.1.0.0: build
Preprocessing library helloworld-0.1.0.0...
[1 of 1] Compiling Lib              ( src/Lib.hs, .stack-work/dist/x86_64-osx/Cabal-1.22.4.0/build/Lib.o )
In-place registering helloworld-0.1.0.0...
Preprocessing executable 'helloworld-exe' for helloworld-0.1.0.0...
[1 of 1] Compiling Main             ( app/Main.hs, .stack-work/dist/x86_64-osx/Cabal-1.22.4.0/build/helloworld-exe/helloworld-exe-tmp/Main.o )
Linking .stack-work/dist/x86_64-osx/Cabal-1.22.4.0/build/helloworld-exe/helloworld-exe ...
helloworld-0.1.0.0: copy/register
Installing library in
/Users/rpw/self/haskell/stack/user_guide/helloworld/.stack-work/install/x86_64-osx/lts-3.13/7.10.2/lib/x86_64-osx-ghc-7.10.2/helloworld-0.1.0.0-6urpPe0MO7OHasGCFSyIAT
Installing executable(s) in
/Users/rpw/self/haskell/stack/user_guide/helloworld/.stack-work/install/x86_64-osx/lts-3.13/7.10.2/bin
Registering helloworld-0.1.0.0...

$ stack exec helloworld-exe
someFunc

$ stack test
Test suite helloworld-test executable not found for helloworld
Test suite failure for package helloworld-0.1.0.0
    helloworld-test:  executable not found
Logs printed to console

$ cat helloworld.cabal 
name:                helloworld
version:             0.1.0.0
synopsis:            Initial project template from stack
description:         Please see README.md
homepage:            ...
license:             BSD3
license-file:        LICENSE
author:              ...
maintainer:          ...
copyright:           None
category:            Example
build-type:          Simple
-- extra-source-files:
cabal-version:       >=1.10

library
  hs-source-dirs:      src
  exposed-modules:     Lib
  build-depends:       base >= 4.7 && < 5
  default-language:    Haskell2010

executable helloworld-exe
  hs-source-dirs:      app
  main-is:             Main.hs
  ghc-options:         -threaded -rtsopts -with-rtsopts=-N
  build-depends:       base
                     , helloworld
  default-language:    Haskell2010

test-suite helloworld-test
  type:                exitcode-stdio-1.0
  hs-source-dirs:      test
  main-is:             Spec.hs
  build-depends:       base
                     , helloworld
  ghc-options:         -threaded -rtsopts -with-rtsopts=-N
  default-language:    Haskell2010

source-repository head
  type:     git
  location: ...
$ 


Robert Weisser


More information about the Beginners mailing list