Skip to content
  • Luke Lau's avatar
    e3d26087
    Fix ghci being launched before other sources were built · e3d26087
    Luke Lau authored
    This looks like an accident from a6e427ac
    It causes cases like this to fail:
    
    $ cat foo.c
    int foo() { return 42; }
    $ cat Lib.hs
    module Lib where
    
    foreign import ccall "foo" foo :: Int
    
    bar = foo
    $ cat cabal-csrc-repl.cabal
    cabal-version:      2.4
    name:               cabal-csrc-repl
    version:            0.1.0.0
    library
        exposed-modules:  Lib
        build-depends:    base ^>=4.14.0.0
        C-sources:        foo.c
        default-language: Haskell2010
    $ cabal v2-repl
    Resolving dependencies...
    Build profile: -w ghc-8.10.1 -O1
    In order, the following will be built (use -v for more details):
     - cabal-csrc-repl-0.1.0.0 (lib) (first run)
    Configuring library for cabal-csrc-repl-0.1.0.0..
    Preprocessing library for cabal-csrc-repl-0.1.0.0..
    GHCi, version 8.10.1: https://www.haskell.org/ghc/  :? for help
    [1 of 1] Compiling Lib              ( Lib.hs, interpreted )
    Ok, one module loaded.
    *Lib> foo
    ghc: ^^ Could not load '_foo', dependency unresolved. See top entry above.
    e3d26087
    Fix ghci being launched before other sources were built
    Luke Lau authored
    This looks like an accident from a6e427ac
    It causes cases like this to fail:
    
    $ cat foo.c
    int foo() { return 42; }
    $ cat Lib.hs
    module Lib where
    
    foreign import ccall "foo" foo :: Int
    
    bar = foo
    $ cat cabal-csrc-repl.cabal
    cabal-version:      2.4
    name:               cabal-csrc-repl
    version:            0.1.0.0
    library
        exposed-modules:  Lib
        build-depends:    base ^>=4.14.0.0
        C-sources:        foo.c
        default-language: Haskell2010
    $ cabal v2-repl
    Resolving dependencies...
    Build profile: -w ghc-8.10.1 -O1
    In order, the following will be built (use -v for more details):
     - cabal-csrc-repl-0.1.0.0 (lib) (first run)
    Configuring library for cabal-csrc-repl-0.1.0.0..
    Preprocessing library for cabal-csrc-repl-0.1.0.0..
    GHCi, version 8.10.1: https://www.haskell.org/ghc/  :? for help
    [1 of 1] Compiling Lib              ( Lib.hs, interpreted )
    Ok, one module loaded.
    *Lib> foo
    ghc: ^^ Could not load '_foo', dependency unresolved. See top entry above.
Loading