Understand relationship between `stack repl` and Cabal (the library) `repl`

Đang mở
#6,548 1 bình luận 0 reaction 1 người được giao Xem trên GitHub

@mpilgrem đang làm issue này rồi.

Từ ngày 3/4/2024.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

component: Cabal library component: ghci type: enhancement

Motivation:

Is there a reason that Stack avoids the use of Cabal (the library) repl (from Cabal >= 2.2)?

Context:
Stack.Build.ExecutePackage.realConfigAndBuild (extracts):

        case ( ee.buildOptsCLI.onlyConfigure
             , ee.buildOptsCLI.initialBuildSteps && taskIsTarget task
             ) of
          ...
          (_, True) | null ac.downstream || installedMapHasThisPkg -> do
            initialBuildSteps cabal announce
...
 where
  ...
  initialBuildSteps cabal announce = do
    announce ("initial-build-steps" <> display annSuffix)
    cabal KeepTHLoading ["repl", "stack-initial-build-steps"]

Stack.GhciCmd.ghciCmd (extracts):

ghciCmd ghciOpts =
  let boptsCLI = defaultBuildOptsCLI
        { ...
        , initialBuildSteps = True
        ...
        }
  in  withConfig YesReexec $ withEnvConfig AllowNoTargets boptsCLI $ do
        bopts <- view buildOptsL
        -- override env so running of tests and benchmarks is disabled
        let boptsLocal = bopts
              { testOpts = bopts.testOpts { TestOpts.disableRun = True }
              , benchmarkOpts =
                  bopts.benchmarkOpts { BenchmarkOpts.disableRun = True }
              }
        local (set buildOptsL boptsLocal) (ghci ghciOpts)

Stack.GhciCmd.ghci (extracts):

-- | Launch a GHCi session for the given project package targets with the given
-- options and configure it with the load paths and extensions of those targets.
ghci :: HasEnvConfig env => GhciOpts -> RIO env ()
ghci opts = do
  ...  
  -- Build required dependencies and setup project packages.
  buildDepsAndInitialSteps opts $
    concatMap (\(pn, (_, t)) -> pkgTargets pn t) localTargets
  ...
  -- Finally, do the invocation of ghci
  runGhci
    opts
    localTargets
    mainFile
    pkgs
    (maybe [] snd mfileTargets)
    (nonLocalTargets ++ addPkgs)
    relevantDependencies

History:

Ngôn ngữ chính
Haskell
Star
4.1k
Fork
857
Merge trung bình
17 giờ 32 phút
Pull request đã merge (30 ngày)
5

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của commercialhaskell/stack

Tất cả issue của commercialhaskell/stack

Issue tương tự

Thêm issue về Haskell

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.