haskell / haskell-mode

Emacs mode for Haskell
http://haskell.github.io/haskell-mode/
GNU General Public License v3.0
1.33k stars 344 forks source link

Is cabal repl TARGET possible on starting ghci? #1840

Open borgauf opened 8 months ago

borgauf commented 8 months ago

If I am in a Haskell project directory and have added packages to my executable build-depends section, is it possible to start haskell-mode REPL with the cabal command

cabal repl TARGET

or

cabal repl --build-depends "vector >= 0.12 && < 0.13"

IOW, I want to start the haskell-mode session with a REPL that can access exactly what my project has for (Hackage) packages and modules. I see the haskell-process-path-cabal variable, but don't know how to configure it in my init file. Again, basically, I just want the same Hackage packages (e.g. QuickSort, hmatrix, etc. that I've added to my regular project to be available in a haskell-mode ghci session. I set everything Haskell up with ghcup, BTW. I've tried in a terminal REPL session

λ> :set -package hmatrix package flags have changed, resetting and loading new packages..

I try

λ> import Numeric.LinearAlgebra λ> m = (3><4) [1..] :: Matrix Double λ> m (3><4) [ 1.0, 2.0, 3.0, 4.0 , 5.0, 6.0, 7.0, 8.0 , 9.0, 10.0, 11.0, 12.0 ]

But none of this works with haskell-mode's REPL interpreter

λ> :set -package QuickCheck cannot satisfy -package QuickCheck (use -v for more information)