Skip to content

Could not load module ‘Test’ It is a member of the hidden package ‘hie-error-0.1.0.0’. #347

Closed
@Congee

Description

@Congee

I can reproduce it with a simple project generated by cabal init. cabal build succeeds, but hie stumbles.

Project structure:

.
├── CHANGELOG.md
├── hie-error.cabal
├── Main.hs
├── Setup.hs
└── src
    └── Test.hs

./Main.hs

module Main where

import Test  -- Could not load module ‘Test’ It is a member of the hidden package ‘hie-error-0.1.0.0’. You can run ‘:set -package hie-error’ to expose it.

main :: IO ()
main = putStrLn "Hello, Haskell!"

./src/Test.hs

module Test where

./hie-error.cabal

cabal-version:       >=1.10
-- Initial package description 'hie-error.cabal' generated by 'cabal init'.
--   For further documentation, see http://haskell.org/cabal/users-guide/

name:                hie-error
version:             0.1.0.0
-- synopsis:
-- description:
-- bug-reports:
-- license:
license-file:        LICENSE
author:              Congee
maintainer:          ...
-- copyright:
-- category:
build-type:          Simple
extra-source-files:  CHANGELOG.md

library
  exposed-modules:     Test
  hs-source-dirs:      src
  default-language:    Haskell2010
  build-depends:       base

executable hie-error
  main-is:             Main.hs
  -- other-modules:
  -- other-extensions:
  build-depends:       base >=4.13 && <4.14, hie-error
  -- hs-source-dirs:
  default-language:    Haskell2010

Nothing interesting in the hie output

2020-08-22 18:18:15.2609133 [ThreadId 77] - Consulting the cradle for "/tmp/hie-error/Main.hs"
Output from setting up the cradle Cradle {cradleRootDir = "/tmp/hie-error", cradleOptsProg = CradleAction: Cabal}
> Resolving dependencies...
> Build profile: -w ghc-8.8.4 -O1
> In order, the following will be built (use -v for more details):
>  - hie-error-0.1.0.0 (lib) (configuration changed)
>  - hie-error-0.1.0.0 (exe:hie-error) (configuration changed)
> Configuring library for hie-error-0.1.0.0..
> Warning: The 'license-file' field refers to the file 'LICENSE' which does not
> exist.
> Preprocessing library for hie-error-0.1.0.0..
> Building library for hie-error-0.1.0.0..
> [1 of 1] Compiling Test             ( src/Test.hs, /tmp/hie-error/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hie-error-0.1.0.0/build/Test.o )
> Configuring executable 'hie-error' for hie-error-0.1.0.0..
> Warning: The package has an extraneous version range for a dependency on an
> internal library: hie-error -any && ==0.1.0.0. This version range includes the
> current package but isn't needed as the current package's library will always
> be used.
> Warning: The 'license-file' field refers to the file 'LICENSE' which does not
> exist.

However, Putting ./src/Test.hs in the project root makes hie happy.

cabal: 3.2.0.0
ghc: 8.8.4
hie: b6c1551 Fri Aug 21 16:04:47 2020 +0100

I believe this issue differs from #299

Metadata

Metadata

Assignees

No one assigned

    Labels

    component: hie-biostype: bugSomething isn't right: doesn't work as intended, documentation is missing/outdated, etc..

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions