lukexi / halive

Live recompiler for Haskell
BSD 2-Clause "Simplified" License
263 stars 18 forks source link

Halive not finding any installed libraries #19

Closed pikajude closed 7 years ago

pikajude commented 7 years ago
$ halive src/Main.hs src
[stuff...]
src/StaticFiles/Delegated.hs:10:1: error:
    Failed to load interface for ‘Data.Text’
    Perhaps you meant Data.Set (from containers-0.5.7.1)
    Use -v to see a list of the files searched for.
src/StaticFiles/Delegated.hs:11:1: error:
    Failed to load interface for ‘Data.Text.Lazy’
    Perhaps you meant
      Data.Map.Lazy (from containers-0.5.7.1)
      Data.STRef.Lazy (from base-4.9.0.0)
    Use -v to see a list of the files searched for.
src/StaticFiles/Delegated.hs:12:1: error:
    Failed to load interface for ‘Data.Text.Lazy.Encoding’
    Use -v to see a list of the files searched for.
src/StaticFiles/Delegated.hs:15:1: error:
    Failed to load interface for ‘System.Process.ByteString.Lazy’
    Use -v to see a list of the files searched for.
$ ghci
GHCi, version 8.0.1: http://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /Users/jude/.dotfiles/ghci
λ import Data.Text
λ :t pack "foo"
pack "foo" ∷ Text

What's going on?

lukexi commented 7 years ago

Are you using cabal or stack? I haven't tested with cabal in a while, maybe something broke...

pikajude commented 7 years ago

cabal. I'm not using a sandbox though. This is a nix dev environment, so ghc-pkg and friends are wrapped with a script that sets the --global-package-db.

lukexi commented 7 years ago

Aha! I'll have to add a flag for setting that then, will do!

On Thu, Jan 5, 2017 at 2:25 PM Jude Taylor notifications@github.com wrote:

cabal. I'm not using a sandbox though. This is a nix dev environment, so ghc-pkg and friends are wrapped with a script that sets the --global-package-db.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/lukexi/halive/issues/19#issuecomment-270775571, or mute the thread https://github.com/notifications/unsubscribe-auth/AACw1scfoccVH3EYzOJl6IsCAIdnNFb-ks5rPW22gaJpZM4LcKNB .

pikajude commented 7 years ago

A flag? Couldn't this be fallback behavior in case a cabal sandbox or stack aren't found?

lukexi commented 7 years ago

Sorry, I haven't used nix — I mean halive needs to know where your global package db is but you're right that it would be more nicely implemented as an automatic behavior. Normally I get this with ghc-paths and then add the cabal and stack sandbox directories if found. Is there a shell command or environment variable I can query for where nix is keeping your package-db?

pikajude commented 7 years ago

I don't have the environment variable names handy, but I was able to get the functionality I needed by adding the result of --print-global-package-db to the GHC session package DBs. I can submit the patch today as a PR

Sent from my iPhone

On Jan 6, 2017, at 3:01 AM, Luke Iannini notifications@github.com wrote:

Sorry, I haven't used nix — I mean halive needs to know where your global package db is but you're right that it would be more nicely implemented as an automatic behavior. Normally I get this with ghc-paths and then add the cabal and stack sandbox directories if found. Is there a shell command or environment variable I can query for where nix is keeping your package-db?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

pikajude commented 7 years ago

https://github.com/lukexi/halive/pull/20

lukexi commented 7 years ago

Excellent, thanks for doing that!