DanielG / ghc-mod

Happy Haskell Hacking for editors. DEPRECATED
Other
677 stars 175 forks source link

ghc-mod seems to get confused by test stanzas #699

Open mwotton opened 8 years ago

mwotton commented 8 years ago

Not sure this is actually enough to diagnose, but here:

elided spec file:

module MandrillResponseSpec where

import           Control.Lens
import           Data.Aeson           (Value (..), decode)
import qualified Data.ByteString.Lazy as BL
import           Data.Maybe           (fromJust)
import           Test.Hspec           (describe, it, shouldBe)
import           Text.Email.Validate  (EmailAddress, emailAddress)
mkMail = fromJust . emailAddress -- YOLO

spec = describe "mandrill response" $ do
  it "can parse a good email as a json string" $
    dummy `shouldBe` dummy

hermes.cabal

name:                hermes
version:             0.1.0.0
synopsis:            Initial project template from stack
description:         Please see README.md
homepage:            http://github.com/mwotton/hermes#readme
license:             BSD3
license-file:        LICENSE
author:              Mark Wotton
maintainer:          mwotton@gmail.com
copyright:           AllRightsReserved
category:            Network
build-type:          Simple
-- extra-source-files:
cabal-version:       >=1.10

library
  hs-source-dirs:      src
  exposed-modules:     
                       MandrillResponse
  build-depends:       base >= 4.7 && < 5
                     , aeson
                     , servant-server
                     , wai
                     , text
                     , email-validate
                     , unordered-containers
                     , lens
                     , bytestring
  default-language:    Haskell2010

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

test-suite hermes-test
  type:                exitcode-stdio-1.0
  hs-source-dirs:      test
  main-is:             Spec.hs
  build-depends:       base
                     , hermes
                     , hspec
                     , raw-strings-qq
                     , aeson
                     , bytestring
                     , email-validate
                     , lens

  ghc-options:         -threaded  -rtsopts -with-rtsopts=-N
  default-language:    Haskell2010

MandrillResponse

module MandrillResponse where

dummy = 1

with a window running

stack build  --file-watch --test --fast

with this setup, ghc-mod will sometimes give this error

orb ➜  git:(hermes) ✗ ghc-mod check test/MandrillResponseSpec.hs
test/MandrillResponseSpec.hs:9:18:Could not find module ‘Test.Hspec’It is a member of the hidden package ‘hspec-2.1.10@hspec_6v6j22VJyLg98uGX19QkK8’.Perhaps you need to add ‘hspec’ to the build-depends in your .cabal file.Use -v to see a list of the files searched for.
orb ➜  git:(hermes) ✗ rm -rf .stack-work/dist                   
orb ➜  git:(hermes) ✗ ghc-mod check test/MandrillResponseSpec.hs
hermes-0.1.0.0: configure
Configuring hermes-0.1.0.0...

@nrolland 's nostackoverride branch does not exhibit the behaviour afaict.

DanielG commented 8 years ago

Next time it happens could you stash the stuff in .stack-work/ somewhere before deleting it and upload that somewhere?