Skip to content

Commit aca287d

Browse files
committed
fix: Extract ghc compile from env
1 parent ed42739 commit aca287d

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/Sabela/Session.hs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ import Control.Concurrent.STM (
1515
import Control.Exception (SomeException, try)
1616
import Control.Monad (forever)
1717
import Data.IORef (IORef, atomicModifyIORef', newIORef, readIORef)
18+
import Data.Maybe (maybeToList)
1819
import Data.Text (Text)
1920
import qualified Data.Text as T
21+
import System.Environment (lookupEnv)
2022
import System.IO (
2123
BufferMode (LineBuffering),
2224
Handle,
@@ -60,7 +62,11 @@ data SessionConfig = SessionConfig
6062

6163
newSession :: SessionConfig -> IO Session
6264
newSession cfg = do
63-
let args = ["repl", "exe:main", "--project-dir=" ++ scProjectDir cfg, "-v0"]
65+
mGhc <- lookupEnv "GHC"
66+
let compilerArgs = ["--with-compiler=" ++ ghc | ghc <- maybeToList mGhc]
67+
args =
68+
["repl", "exe:main", "--project-dir=" ++ scProjectDir cfg, "-v0"]
69+
++ compilerArgs
6470
cp =
6571
(proc "cabal" args)
6672
{ std_in = CreatePipe

0 commit comments

Comments
 (0)