Skip to content

Can't find project modules in test/Spec.hs until I restart VSCode #1909

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sekunho opened this issue Jun 11, 2021 · 7 comments
Closed

Can't find project modules in test/Spec.hs until I restart VSCode #1909

sekunho opened this issue Jun 11, 2021 · 7 comments
Labels
build tool: stack os: nixos type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..

Comments

@sekunho
Copy link

sekunho commented Jun 11, 2021

Your environment

Output of haskell-language-server --probe-tools or haskell-language-server-wrapper --probe-tools:

I don't know how to run this in VSCode.

Which OS do you use:
NixOS 21.05

Which lsp-client do you use:
VSCode's official hls plugin

Describe your project (alternative: link to the project):
I'm using stack. Following the simple haskell handbook project.

resolver: lts-17.10
packages: [.]
nix:
  enable: true
  packages: [ zlib ]
name: quad

default-extensions:
  - BlockArguments
  - DeriveAnyClass
  - DeriveGeneric
  - LambdaCase
  - NoImplicitPrelude
  - OverloadedStrings
  - StrictData

dependencies:
  - aeson
  - async
  - base
  - butcher
  - hslogger
  - http-client
  - http-conduit
  - http-types
  - network
  - record-hasfield
  - rio
  - scotty
  - serialise
  - stm
  - time
  - typed-process
  - wai-cors
  - yaml

ghc-options:
  - -F -pgmF=record-dot-preprocessor

library:
  source-dirs: src

executables:
  quad: 
    main: Main.hs
    source-dirs: app
    ghc-options:
      - -threaded
      - -rtsopts
      - -with-rtsopts=-N
    dependencies:
      - quad

tests:
  quad-test:
    main: Spec.hs
    source-dirs: test
    ghc-options:
      - -threaded
      - -rtsopts
      - -with-rtsopts=-N
    dependencies:
      - quad
      - hspec

Contents of hie.yaml:
N/A

Steps to reproduce

The project is structured this way:

image

Then when trying to import the Docker module, HLS complains about how it can't find it.

image

What's weird is that previously, it couldn't find the Core module. Not sure what changed, and weird that this time it doesn't know what the Docker module is even if it's just in the same folder as Core.

Expected behaviour

It's supposed to import the project's modules just fine in the test.

Actual behaviour

It can't find the modules properly.

Include debug information

So I tried following the instructions, and restarted VSCode. Now it seems to detect it normally. But does it mean I have to restart VSCode every time I add a new module? Weird that when I tried restarting the LSP server, it still had the same issue so I had to restart the entire VSCode for it to work.

@sekunho sekunho changed the title HLS doesn't detect project modules in stack project for test/Spec.hs Can't find project modules in test/Spec.hs until I restart VSCode Jun 11, 2021
@jneira jneira added os: nixos type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc.. type: setup build tool: stack labels Jun 11, 2021
@jneira
Copy link
Member

jneira commented Jun 11, 2021

Hi, thanks for the bug report, is it possible that the quad.cabal file generated from package.yaml does not include the new module when hls did not find it?

@sekunho
Copy link
Author

sekunho commented Jun 11, 2021

Hello.

So I tested that out. I created a new module called Sample. This is what was generated in quad.cabal:

image

It seems like it was able to detect it just fine, I think. Stack seems to recognize it as well because both the stack build, and stack test work without throwing any errors about a missing module. I then imported it in test/Spec.hs, where HLS doesn't seem to find it.

image

Just in case, here's the entire quad.cabal:

cabal-version: 1.12

-- This file has been generated from package.yaml by hpack version 0.34.4.
--
-- see: https://github.com/sol/hpack

name:           quad
version:        0.0.0
build-type:     Simple

library
  exposed-modules:
      Core
      Docker
      Sample
      Socket
  other-modules:
      Paths_quad
  hs-source-dirs:
      src
  default-extensions:
      BlockArguments
      DeriveAnyClass
      DeriveGeneric
      LambdaCase
      NoImplicitPrelude
      OverloadedStrings
      StrictData
  ghc-options: -F -pgmF=record-dot-preprocessor
  build-depends:
      aeson
    , async
    , base
    , butcher
    , hslogger
    , http-client
    , http-conduit
    , http-types
    , network
    , record-hasfield
    , rio
    , scotty
    , serialise
    , stm
    , time
    , typed-process
    , wai-cors
    , yaml
  default-language: Haskell2010

executable quad
  main-is: Main.hs
  other-modules:
      Paths_quad
  hs-source-dirs:
      app
  default-extensions:
      BlockArguments
      DeriveAnyClass
      DeriveGeneric
      LambdaCase
      NoImplicitPrelude
      OverloadedStrings
      StrictData
  ghc-options: -F -pgmF=record-dot-preprocessor -threaded -rtsopts -with-rtsopts=-N
  build-depends:
      aeson
    , async
    , base
    , butcher
    , hslogger
    , http-client
    , http-conduit
    , http-types
    , network
    , quad
    , record-hasfield
    , rio
    , scotty
    , serialise
    , stm
    , time
    , typed-process
    , wai-cors
    , yaml
  default-language: Haskell2010

test-suite quad-test
  type: exitcode-stdio-1.0
  main-is: Spec.hs
  other-modules:
      Paths_quad
  hs-source-dirs:
      test
  default-extensions:
      BlockArguments
      DeriveAnyClass
      DeriveGeneric
      LambdaCase
      NoImplicitPrelude
      OverloadedStrings
      StrictData
  ghc-options: -F -pgmF=record-dot-preprocessor -threaded -rtsopts -with-rtsopts=-N
  build-depends:
      aeson
    , async
    , base
    , butcher
    , hslogger
    , hspec
    , http-client
    , http-conduit
    , http-types
    , network
    , quad
    , record-hasfield
    , rio
    , scotty
    , serialise
    , stm
    , time
    , typed-process
    , wai-cors
    , yaml
  default-language: Haskell2010

@googleson78
Copy link
Contributor

Hey @hsek could you try doing the following things outside of vscode?

  1. Create a new module/function in src
  2. Import it from the tests
  3. Run the HLS executable manually on your tests

I think I'm having the same issue (also using stack, but via vim), where until I manually recompile my lib, hls refuses to acknowledge its existence.

Additionally I would be grateful if you could also try

  1. Make a change in src.
  2. Do something to the tests that forces them to not compile
  3. Try running the HLS executable on the tests.

When I do the same, instead of getting the error reported to me in the test suite, I get a "cannot find package blabla..." error, referring to the library again. The purpose of this is to hopefully see if there's more of a link between the first (your) error case, and #735

@sekunho
Copy link
Author

sekunho commented Jun 11, 2021

I followed what @googleson78 asked.

Installed hls in nix-shell.

{ pkgs ? import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/60cce7e5e1fdf62421ef6d4184ee399b46209366.tar.gz") {} }:
  
with pkgs;

let
  inherit (lib) optional optionals;
in

mkShell {
  buildInputs = with haskellPackages; [
    stack
    ghc
    zlib
    record-dot-preprocessor
    haskell-language-server
  ]
    ++ optional stdenv.isLinux libnotify
    ++ optional stdenv.isLinux inotify-tools;
}

From within nix-shell, I ran haskell-language-server. Here is a portion of the log:

File:     /home/sekun/Projects/quad-ci/src/Docker.hs
Hidden:   no
Range:    40:18-40:25
Source:   hlint
Severity: DsInfo
Message:  Redundant bracketFound:(Image)Why not:Image
File:     /home/sekun/Projects/quad-ci/src/Docker.hs
Hidden:   no
Range:    40:49-40:73
Source:   hlint
Severity: DsInfo
Message:  Redundant bracketFound:(CreateContainerOptions)Why not:CreateContainerOptions
2021-06-11 22:04:34.933965077 [ThreadId 285] INFO hls:	File:     /home/sekun/Projects/quad-ci/test/Spec.hs
Hidden:   no
Range:    7:18-7:24
Source:   not found
Severity: DsError
Message: 
  Could not find module ‘Sample’
  It is not a module in the current program, or in any known package.
2021-06-11 22:04:35.210355872 [ThreadId 477] INFO hls:	File:     /home/sekun/Projects/quad-ci/src/Docker.hs
Hidden:   no
Range:    8:1-10:4
Source:   hlint
Severity: DsInfo
Message: 
  Use newtype instead of data
  Found:
  data CreateContainerOptions
  = CreateContainerOptions {image :: Image}
  Why not:
  newtype CreateContainerOptions
  = CreateContainerOptions {image :: Image}
  decreases laziness
File:     /home/sekun/Projects/quad-ci/src/Docker.hs
Hidden:   no
Range:    40:18-40:25
Source:   hlint
Severity: DsInfo
Message:  Redundant bracketFound:(Image)Why not:Image
File:     /home/sekun/Projects/quad-ci/src/Docker.hs
Hidden:   no
Range:    40:49-40:73
Source:   hlint
Severity: DsInfo
Message:  Redundant bracketFound:(CreateContainerOptions)Why not:CreateContainerOptions
File:     /home/sekun/Projects/quad-ci/src/Docker.hs
Hidden:   no
Range:    32:3-32:14
Source:   typecheck
Severity: DsWarning
Message: 
  In the use of ‘traceShowIO’
  (imported from RIO, but defined in rio-0.1.20.0:RIO.Prelude.Trace):
  "Trace statement left in code"
2021-06-11 22:04:35.262396091 [ThreadId 487] INFO hls:	finish: User TypeCheck (took 0.41s)
2021-06-11 22:04:35.275190287 [ThreadId 495] INFO hls:	finish: GetHie (took 0.01s)
Files that failed:
 * /home/sekun/Projects/quad-ci/test/Spec.hs

Completed (5 files worked, 1 file failed)
2021-06-11 22:04:35.299195348 [ThreadId 499] INFO hls:	finish: GenerateCore (took 0.02s)

Sample is imported in test/Spec.hs, and it seems like Sample, which was the new module I made earlier, isn't detected.

Made a change in Sample, foo a b = a + b to foo a b = a * b. I don't know if I followed this correctly, I made it not compile successfully by typing a type incorrectly. Both changes were done in vim. Then I ran haskell-language-server again. Results:

[nix-shell:~/Projects/quad-ci]$ haskell-language-server
haskell-language-server version: 1.1.0.0 (GHC: 8.10.4) (PATH: /nix/store/nkvi9d5pmimx05pizlrf3ysp3ahqccc2-haskell-language-server-1.1.0.0/bin/haskell-language-server)
 ghcide setup tester in /home/sekun/Projects/quad-ci.
Report bugs at https://github.com/haskell/haskell-language-server/issues

Step 1/4: Finding files to test in /home/sekun/Projects/quad-ci
Found 6 files

Step 2/4: Looking for hie.yaml files that control setup
Found 1 cradle
  ()

Step 3/4: Initializing the IDE

Step 4/4: Type checking the files
2021-06-11 22:37:30.115438897 [ThreadId 45] INFO hls:	Consulting the cradle for "src/Sample.hs"
2021-06-11 22:37:30.115620846 [ThreadId 45] WARNING hls:	No [cradle](https://github.com/mpickering/hie-bios#hie-bios) found for src/Sample.hs.
 Proceeding with [implicit cradle](https://hackage.haskell.org/package/implicit-hie).
You should ignore this message, unless you see a 'Multi Cradle: No prefixes matched' error.
Output from setting up the cradle Cradle {cradleRootDir = "/home/sekun/Projects/quad-ci", cradleOptsProg = CradleAction: Stack}
> quad> configure (lib)
> Configuring quad-0.0.0...
> quad> initial-build-steps (lib)
> Configuring GHCi with the following packages: quad
> /home/sekun/Projects/quad-ci/.stack-work/install/x86_64-linux-nix/1a00d0a68d8d1770d26b58de248de2f2112766b95d463d1d245219d2934a405c/8.10.4/pkgdb:/home/sekun/.stack/snapshots/x86_64-linux-nix/1a00d0a68d8d1770d26b58de248de2f2112766b95d463d1d245219d2934a405c/8.10.4/pkgdb:/nix/store/mcm0wvsqcwqaxsp8fnwmknmpi0a196w6-ghc-8.10.4/lib/ghc-8.10.4/package.conf.d
2021-06-11 22:37:38.295751751 [ThreadId 45] INFO hls:	Using interface files cache dir: /home/sekun/.cache/ghcide/main-5bcdce7963e24c6bb7e26bb71843962c53110b52
2021-06-11 22:37:38.296074626 [ThreadId 45] INFO hls:	Making new HscEnv[main]
2021-06-11 22:37:38.323856862 [ThreadId 99] INFO hls:	Consulting the cradle for "test/Spec.hs"
2021-06-11 22:37:38.324007669 [ThreadId 99] WARNING hls:	No [cradle](https://github.com/mpickering/hie-bios#hie-bios) found for test/Spec.hs.
 Proceeding with [implicit cradle](https://hackage.haskell.org/package/implicit-hie).
You should ignore this message, unless you see a 'Multi Cradle: No prefixes matched' error.
Output from setting up the cradle Cradle {cradleRootDir = "/home/sekun/Projects/quad-ci", cradleOptsProg = CradleAction: Stack}
2021-06-11 22:37:38.386217049 [ThreadId 122] INFO hls:	File:     /home/sekun/Projects/quad-ci/src/Docker.hs
Hidden:   no
Range:    8:1-10:4
Source:   hlint
Severity: DsInfo
Message: 
  Use newtype instead of data
  Found:
  data CreateContainerOptions
  = CreateContainerOptions {image :: Image}
  Why not:
  newtype CreateContainerOptions
  = CreateContainerOptions {image :: Image}
  decreases laziness
File:     /home/sekun/Projects/quad-ci/src/Docker.hs
Hidden:   no
Range:    40:18-40:25
Source:   hlint
Severity: DsInfo
Message:  Redundant bracketFound:(Image)Why not:Image
File:     /home/sekun/Projects/quad-ci/src/Docker.hs
Hidden:   no
Range:    40:49-40:73
Source:   hlint
Severity: DsInfo
Message:  Redundant bracketFound:(CreateContainerOptions)Why not:CreateContainerOptions
> Using main module: 1. Package `quad' component quad:test:quad-test with main-is file: /home/sekun/Projects/quad-ci/test/Spec.hs
> quad> configure (lib + test)
> Configuring quad-0.0.0...
> quad> initial-build-steps (lib + test)
> quad> Test running disabled by --no-run-tests flag.
> Completed 2 action(s).
> The following GHC options are incompatible with GHCi and have not been passed to it: -threaded
> Configuring GHCi with the following packages: quad
> /home/sekun/Projects/quad-ci/.stack-work/install/x86_64-linux-nix/1a00d0a68d8d1770d26b58de248de2f2112766b95d463d1d245219d2934a405c/8.10.4/pkgdb:/home/sekun/.stack/snapshots/x86_64-linux-nix/1a00d0a68d8d1770d26b58de248de2f2112766b95d463d1d245219d2934a405c/8.10.4/pkgdb:/nix/store/mcm0wvsqcwqaxsp8fnwmknmpi0a196w6-ghc-8.10.4/lib/ghc-8.10.4/package.conf.d
2021-06-11 22:37:46.715868988 [ThreadId 99] INFO hls:	Using interface files cache dir: /home/sekun/.cache/ghcide/main-389f9d2e775c8205038562123c97567d3d28c7a3
2021-06-11 22:37:46.716157727 [ThreadId 99] INFO hls:	Using interface files cache dir: /home/sekun/.cache/ghcide/main-389f9d2e775c8205038562123c97567d3d28c7a3
2021-06-11 22:37:46.716395333 [ThreadId 99] INFO hls:	Making new HscEnv[main,main]
2021-06-11 22:37:46.748957864 [ThreadId 182] INFO hls:	Consulting the cradle for "app/Main.hs"
2021-06-11 22:37:46.749096809 [ThreadId 182] WARNING hls:	No [cradle](https://github.com/mpickering/hie-bios#hie-bios) found for app/Main.hs.
 Proceeding with [implicit cradle](https://hackage.haskell.org/package/implicit-hie).
You should ignore this message, unless you see a 'Multi Cradle: No prefixes matched' error.
Output from setting up the cradle Cradle {cradleRootDir = "/home/sekun/Projects/quad-ci", cradleOptsProg = CradleAction: Stack}
2021-06-11 22:37:46.782083875 [ThreadId 210] INFO hls:	File:     /home/sekun/Projects/quad-ci/test/Spec.hs
Hidden:   no
Range:    7:18-7:24
Source:   not found
Severity: DsError
Message: 
  Could not find module ‘Sample’
  It is not a module in the current program, or in any known package.
> Using main module: 1. Package `quad' component quad:exe:quad with main-is file: /home/sekun/Projects/quad-ci/app/Main.hs
> quad> configure (lib + exe)
> Configuring quad-0.0.0...
> quad> initial-build-steps (lib + exe)
> The following GHC options are incompatible with GHCi and have not been passed to it: -threaded
> Configuring GHCi with the following packages: quad
> /home/sekun/Projects/quad-ci/.stack-work/install/x86_64-linux-nix/1a00d0a68d8d1770d26b58de248de2f2112766b95d463d1d245219d2934a405c/8.10.4/pkgdb:/home/sekun/.stack/snapshots/x86_64-linux-nix/1a00d0a68d8d1770d26b58de248de2f2112766b95d463d1d245219d2934a405c/8.10.4/pkgdb:/nix/store/mcm0wvsqcwqaxsp8fnwmknmpi0a196w6-ghc-8.10.4/lib/ghc-8.10.4/package.conf.d
2021-06-11 22:37:54.858287719 [ThreadId 182] INFO hls:	Using interface files cache dir: /home/sekun/.cache/ghcide/main-c40e8d7c285f23f85e38ee6dd34c9a8f099a21a3
2021-06-11 22:37:54.858561802 [ThreadId 182] INFO hls:	Using interface files cache dir: /home/sekun/.cache/ghcide/main-c40e8d7c285f23f85e38ee6dd34c9a8f099a21a3
2021-06-11 22:37:54.858788526 [ThreadId 182] INFO hls:	Using interface files cache dir: /home/sekun/.cache/ghcide/main-c40e8d7c285f23f85e38ee6dd34c9a8f099a21a3
2021-06-11 22:37:54.859000303 [ThreadId 182] INFO hls:	Making new HscEnv[main,main,main]
2021-06-11 22:37:55.054720156 [ThreadId 349] INFO hls:	File:     /home/sekun/Projects/quad-ci/src/Core.hs
Hidden:   no
Range:    8:1-10:4
Source:   hlint
Severity: DsInfo
Message: 
  Use newtype instead of data
  Found:
  data Pipeline = Pipeline {steps :: NonEmpty Step}
  Why not:
  newtype Pipeline = Pipeline {steps :: NonEmpty Step}
  decreases laziness
File:     /home/sekun/Projects/quad-ci/src/Core.hs
Hidden:   no
Range:    35:1-36:22
Source:   hlint
Severity: DsInfo
Message: 
  Use newtype instead of data
  Found:
  data BuildRunningState
  = BuildRunningState {step :: StepName}
  deriving (Eq, Show)
  Why not:
  newtype BuildRunningState
  = BuildRunningState {step :: StepName}
  deriving (Eq, Show)
  decreases laziness
File:     /home/sekun/Projects/quad-ci/src/Core.hs
Hidden:   no
Range:    51:8-51:35
Source:   hlint
Severity: DsInfo
Message: 
  Redundant bracket
  Found:
  case (Z.getField @"state" build) of
  BuildReady
  -> case buildHasNextStep build of
  Left result
  -> pure $ (Z.setField @"state" build (BuildFinished result))
  Right step
  -> do let s = BuildRunningState {step = (Z.getField @"name" step)}
  pure $ (Z.setField @"state" build (BuildRunning s))
  BuildRunning state
  -> do let exit = Docker.ContainerExitCode 0
  let result = exitCodeToStepResult exit
  pure
  build
  {state = BuildReady,
  completedSteps = Map.insert
  (Z.getField @"step" state) result
  (Z.getField @"completedSteps" build)}
  BuildFinished _ -> pure build
  Why not:
  case Z.getField @"state" build of
  BuildReady
  -> case buildHasNextStep build of
  Left result
  -> pure $ (Z.setField @"state" build (BuildFinished result))
  Right step
  -> do let s = BuildRunningState {step = (Z.getField @"name" step)}
  pure $ (Z.setField @"state" build (BuildRunning s))
  BuildRunning state
  -> do let exit = Docker.ContainerExitCode 0
  let result = exitCodeToStepResult exit
  pure
  build
  {state = BuildReady,
  completedSteps = Map.insert
  (Z.getField @"step" state) result
  (Z.getField @"completedSteps" build)}
  BuildFinished _ -> pure build
File:     /home/sekun/Projects/quad-ci/src/Core.hs
Hidden:   no
Range:    55:16-55:17
Source:   hlint
Severity: DsInfo
Message: 
  Redundant $
  Found:
  pure $ (Z.setField @"state" build (BuildFinished result))
  Why not:
  pure (Z.setField @"state" build (BuildFinished result))
File:     /home/sekun/Projects/quad-ci/src/Core.hs
Hidden:   no
Range:    55:18-55:68
Source:   hlint
Severity: DsInfo
Message: 
  Redundant bracket
  Found:
  pure $ (Z.setField @"state" build (BuildFinished result))
  Why not:
  pure $ Z.setField @"state" build (BuildFinished result)
File:     /home/sekun/Projects/quad-ci/src/Core.hs
Hidden:   no
Range:    57:45-57:70
Source:   hlint
Severity: DsInfo
Message: 
  Redundant bracket
  Found:
  BuildRunningState {step = (Z.getField @"name" step)}
  Why not:
  BuildRunningState {step = Z.getField @"name" step}
File:     /home/sekun/Projects/quad-ci/src/Core.hs
Hidden:   no
Range:    58:16-58:17
Source:   hlint
Severity: DsInfo
Message: 
  Redundant $
  Found:
  pure $ (Z.setField @"state" build (BuildRunning s))
  Why not:
  pure (Z.setField @"state" build (BuildRunning s))
File:     /home/sekun/Projects/quad-ci/src/Core.hs
Hidden:   no
Range:    58:18-58:62
Source:   hlint
Severity: DsInfo
Message: 
  Redundant bracket
  Found:
  pure $ (Z.setField @"state" build (BuildRunning s))
  Why not:
  pure $ Z.setField @"state" build (BuildRunning s)
File:     /home/sekun/Projects/quad-ci/src/Core.hs
Hidden:   no
Range:    79:29-79:49
Source:   hlint
Severity: DsInfo
Message:  Use sectionFound:((==) StepSucceeded)Why not:(StepSucceeded ==)
File:     /home/sekun/Projects/quad-ci/src/Core.hs
Hidden:   no
Range:    88:18-88:33
Source:   hlint
Severity: DsInfo
Message:  Redundant bracketFound:aplg ~ (NonEmpty Step)Why not:aplg ~ NonEmpty Step
File:     /home/sekun/Projects/quad-ci/src/Core.hs
Hidden:   no
Range:    88:57-88:67
Source:   hlint
Severity: DsInfo
Message:  Redundant bracketFound:(Pipeline)Why not:Pipeline
File:     /home/sekun/Projects/quad-ci/src/Core.hs
Hidden:   no
Range:    89:18-89:28
Source:   hlint
Severity: DsInfo
Message:  Redundant bracketFound:(StepName)Why not:StepName
File:     /home/sekun/Projects/quad-ci/src/Core.hs
Hidden:   no
Range:    89:51-89:57
Source:   hlint
Severity: DsInfo
Message:  Redundant bracketFound:(Step)Why not:Step
File:     /home/sekun/Projects/quad-ci/src/Core.hs
Hidden:   no
Range:    90:18-90:33
Source:   hlint
Severity: DsInfo
Message:  Redundant bracketFound:aplg ~ (NonEmpty Text)Why not:aplg ~ NonEmpty Text
File:     /home/sekun/Projects/quad-ci/src/Core.hs
Hidden:   no
Range:    90:60-90:66
Source:   hlint
Severity: DsInfo
Message:  Redundant bracketFound:(Step)Why not:Step
File:     /home/sekun/Projects/quad-ci/src/Core.hs
Hidden:   no
Range:    91:18-91:32
Source:   hlint
Severity: DsInfo
Message:  Redundant bracketFound:(Docker.Image)Why not:Docker.Image
File:     /home/sekun/Projects/quad-ci/src/Core.hs
Hidden:   no
Range:    91:56-91:62
Source:   hlint
Severity: DsInfo
Message:  Redundant bracketFound:(Step)Why not:Step
File:     /home/sekun/Projects/quad-ci/src/Core.hs
Hidden:   no
Range:    92:18-92:28
Source:   hlint
Severity: DsInfo
Message:  Redundant bracketFound:(Pipeline)Why not:Pipeline
File:     /home/sekun/Projects/quad-ci/src/Core.hs
Hidden:   no
Range:    92:55-92:62
Source:   hlint
Severity: DsInfo
Message:  Redundant bracketFound:(Build)Why not:Build
File:     /home/sekun/Projects/quad-ci/src/Core.hs
Hidden:   no
Range:    93:18-93:30
Source:   hlint
Severity: DsInfo
Message:  Redundant bracketFound:(BuildState)Why not:BuildState
File:     /home/sekun/Projects/quad-ci/src/Core.hs
Hidden:   no
Range:    93:54-93:61
Source:   hlint
Severity: DsInfo
Message:  Redundant bracketFound:(Build)Why not:Build
File:     /home/sekun/Projects/quad-ci/src/Core.hs
Hidden:   no
Range:    94:18-94:43
Source:   hlint
Severity: DsInfo
Message: 
  Redundant bracket
  Found:
  aplg ~ (Map StepName StepResult)
  Why not:
  aplg ~ Map StepName StepResult
File:     /home/sekun/Projects/quad-ci/src/Core.hs
Hidden:   no
Range:    94:76-94:83
Source:   hlint
Severity: DsInfo
Message:  Redundant bracketFound:(Build)Why not:Build
File:     /home/sekun/Projects/quad-ci/src/Core.hs
Hidden:   no
Range:    95:18-95:28
Source:   hlint
Severity: DsInfo
Message:  Redundant bracketFound:(StepName)Why not:StepName
File:     /home/sekun/Projects/quad-ci/src/Core.hs
Hidden:   no
Range:    95:51-95:70
Source:   hlint
Severity: DsInfo
Message:  Redundant bracketFound:(BuildRunningState)Why not:BuildRunningState
2021-06-11 22:37:55.178755983 [ThreadId 566] INFO hls:	File:     /home/sekun/Projects/quad-ci/src/Docker.hs
Hidden:   no
Range:    8:1-10:4
Source:   hlint
Severity: DsInfo
Message: 
  Use newtype instead of data
  Found:
  data CreateContainerOptions
  = CreateContainerOptions {image :: Image}
  Why not:
  newtype CreateContainerOptions
  = CreateContainerOptions {image :: Image}
  decreases laziness
File:     /home/sekun/Projects/quad-ci/src/Docker.hs
Hidden:   no
Range:    40:18-40:25
Source:   hlint
Severity: DsInfo
Message:  Redundant bracketFound:(Image)Why not:Image
File:     /home/sekun/Projects/quad-ci/src/Docker.hs
Hidden:   no
Range:    40:49-40:73
Source:   hlint
Severity: DsInfo
Message:  Redundant bracketFound:(CreateContainerOptions)Why not:CreateContainerOptions
File:     /home/sekun/Projects/quad-ci/src/Docker.hs
Hidden:   no
Range:    32:3-32:14
Source:   typecheck
Severity: DsWarning
Message: 
  In the use of ‘traceShowIO’
  (imported from RIO, but defined in rio-0.1.20.0:RIO.Prelude.Trace):
  "Trace statement left in code"
2021-06-11 22:37:55.230508392 [ThreadId 576] INFO hls:	finish: User TypeCheck (took 0.34s)
2021-06-11 22:37:55.241135471 [ThreadId 584] INFO hls:	finish: GetHie (took 0.01s)
Files that failed:
 * /home/sekun/Projects/quad-ci/test/Spec.hs
2021-06-11 22:37:55.26629557 [ThreadId 588] INFO hls:	finish: GenerateCore (took 0.03s)

Completed (5 files worked, 1 file failed)

Then I ran stack test

[nix-shell:~/Projects/quad-ci]$ stack test
quad-0.0.0: unregistering (components added: exe:quad)
quad> configure (lib + exe + test)
Configuring quad-0.0.0...
quad> build (lib + exe + test)
Preprocessing library for quad-0.0.0..
Building library for quad-0.0.0..
[1 of 5] Compiling Paths_quad
[2 of 5] Compiling Sample
[3 of 5] Compiling Socket
[4 of 5] Compiling Docker
            
/home/sekun/Projects/quad-ci/src/Docker.hs:32:3: warning: [-Wdeprecations]
    In the use of ‘traceShowIO’
    (imported from RIO, but defined in rio-0.1.20.0:RIO.Prelude.Trace):
    "Trace statement left in code"
   |        
32 |   traceShowIO res
   |   ^^^^^^^^^^^
[5 of 5] Compiling Core [Docker changed]
Preprocessing executable 'quad' for quad-0.0.0..
Building executable 'quad' for quad-0.0.0..
[2 of 2] Compiling Paths_quad
Linking .stack-work/dist/x86_64-linux-nix/Cabal-3.2.1.0/build/quad/quad ...
Preprocessing test suite 'quad-test' for quad-0.0.0..
Building test suite 'quad-test' for quad-0.0.0..
[2 of 2] Compiling Main
            
/home/sekun/Projects/quad-ci/test/Spec.hs:23:17: error:
    Not in scope: type constructor or class ‘Pipelin’
    Perhaps you meant ‘Pipeline’ (imported from Core)
   |        
23 | testPipeline :: Pipelin
   |                 ^^^^^^^
            
Progress 1/2

--  While building package quad-0.0.0 (scroll up to its section to see the error) using:
      /home/sekun/.stack/setup-exe-cache/x86_64-linux-nix/Cabal-simple_mPHDZzAJ_3.2.1.0_ghc-8.10.4 --builddir=.stack-work/dist/x86_64-linux-nix/Cabal-3.2.1.0 build lib:quad exe:quad test:quad-test --ghc-options " -fdiagnostics-color=always"
    Process exited with code: ExitFailure 1

Let me know if I did something incorrectly.

@sekunho
Copy link
Author

sekunho commented Jun 11, 2021

I made the repo public in case someone wants to reproduce the issue. I isolated it in a nix environment, so hopefully that would make things easier.

https://github.com/hsek/quad-ci/tree/fa44eb79b6b6085fc7326f88973e5047936d7efd

@sekunho
Copy link
Author

sekunho commented Jun 12, 2021

I also noticed that I got the same error message as #735 after performing the above, and then going back to VSCode. Had to run stack clean then stack build for it to go away. It seems related.

@jneira
Copy link
Member

jneira commented Oct 10, 2021

I think it the root issue is the same as #366, so the resolution and the possible workaround will be the same too.
Feel free to reopen if you think this one differs in some fundamental way, thanks!

@sekunho sekunho closed this as completed Oct 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build tool: stack os: nixos type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..
Projects
None yet
Development

No branches or pull requests

3 participants