A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/commercialhaskell/stack/issues/498 below:

`stack ghci` doesn't see preprocessed (e.g. c2hs) files, and doesn't error · Issue #498 · commercialhaskell/stack · GitHub

Steps to reproduce:

$ stack --version
Version 0.1.1.0, Git revision bf086c6d5f8e86e95f161c38c596a6dae571ab65

pkg-a.cabal:

name:                pkg-a
version:             0.1.0.0
build-type:          Simple
cabal-version:       >= 1.10

library
  exposed-modules:     A
  build-depends:       base >= 4.7 && < 5
  default-language:    Haskell2010

A.chs:

stack.yaml:

flags: {}
packages:
- '.'
extra-deps: []
resolver: nightly-2015-06-28

Expected:

Running stack ghci builds and loads module A (after preprocessing with c2hs).

Actual:

$ stack ghci
Configuring GHCi with the following packages: pkg-a
GHCi, version 7.10.1: http://www.haskell.org/ghc/  :? for help
Prelude λ import A

<no location info>:
    Could not find module ‘A’
    It is not a module in the current program, or in any known package.
Prelude λ

# ok, let's install it into stack work
$ stack build
pkg-a-0.1.0.0: build
Building pkg-a-0.1.0.0...
Preprocessing library pkg-a-0.1.0.0...
[1 of 1] Compiling A                ( .stack-work/dist/x86_64-osx/Cabal-1.22.2.0/build/A.hs, .stack-work/dist/x86_64-osx/Cabal-1.22.2.0/build/A.o )
In-place registering pkg-a-0.1.0.0...
pkg-a-0.1.0.0: install
Installing library in
/Users/mtolly/git/stackbugs/.stack-work/install/x86_64-osx/nightly-2015-06-28/7.10.1/lib/x86_64-osx-ghc-7.10.1/pkga_9rCkBC6ycwY3RIqsB0Qe80
Registering pkg-a-0.1.0.0...

$ stack ghci
Configuring GHCi with the following packages: pkg-a
GHCi, version 7.10.1: http://www.haskell.org/ghc/  :? for help
Prelude λ import A

<no location info>:
    Could not find module ‘A’
    It is a member of the hidden package ‘pkg-a-0.1.0.0@pkga_9rCkBC6ycwY3RIqsB0Qe80’.
Prelude λ

# this loads the installed (in stack work) package, not the current source
$ stack ghci --ghc-options "-package pkg-a"
Configuring GHCi with the following packages: pkg-a
GHCi, version 7.10.1: http://www.haskell.org/ghc/  :? for help
Prelude λ import A
Prelude A λ
Leaving GHCi.

Actually you'll get this result if the A file is named anything other than A.hs (like A.foobar), or even if it doesn't exist at all.

So there are 2 bugs:

  1. Module A is not loaded when it's a non-.hs extension
  2. The fact that module A wasn't found while supposedly loading pkg-a does not cause an error

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4