packages feed

ollama-holes-plugin 0.1.3.0 → 0.1.4.0

raw patch · 2 files changed

+30/−8 lines, 2 filesdep +containersdep ~basedep ~ghcPVP ok

version bump matches the API change (PVP)

Dependencies added: containers

Dependency ranges changed: base, ghc

API changes (from Hackage documentation)

Files

ollama-holes-plugin.cabal view
@@ -1,4 +1,4 @@-cabal-version:      3.0+cabal-version:      3.4 -- The cabal-version field refers to the version of the .cabal specification, -- and can be different from the cabal-install (the tool) version and the -- Cabal (the library) version you are using. As such, the Cabal (the library)@@ -20,7 +20,7 @@ -- PVP summary:     +-+------- breaking API changes --                  | | +----- non-breaking API additions --                  | | | +--- code changes with no API change-version:            0.1.3.0+version:            0.1.4.0  -- A short (one-line) description of the package. synopsis: A typed-hole plugin that uses LLMs to generate valid hole-fits@@ -86,7 +86,7 @@ -- A copyright notice. copyright:          2025 (c) Matthias Pall Gissurarson   category:           Development, Compiler Plugin-tested-with:        GHC == 9.6.*+tested-with:        GHC == 9.6.*, GHC == 9.8.*, GHC == 9.10.*, GHC == 9.12.* build-type:         Simple  -- Extra doc files to be distributed with the package, such as a CHANGELOG or a README.@@ -122,14 +122,15 @@     -- other-extensions:      -- Other library packages from which modules are imported.-    build-depends:    base ^>=4.18.2.1,-                      ghc ^>=9.6,+    build-depends:    base >= 4.18 && < 4.22,+                      ghc >= 9.6 && < 9.14,                       ollama-haskell ^>= 0.1,                       text ^>= 2.1,                       req ^>= 3.13,                       modern-uri ^>= 0.3,                       aeson ^>= 2.2,-                      exceptions ^>= 0.10+                      exceptions ^>= 0.10,+                      containers >= 0.6 && < 0.8       -- Directories containing source files.
src/GHC/Plugin/OllamaHoles.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} @@ -11,7 +12,7 @@ import Data.Text.IO qualified as T import GHC.Plugins hiding ((<>)) import GHC.Tc.Types-import GHC.Tc.Types.Constraint (Hole (..), ctLocEnv, ctLocSpan)+import GHC.Tc.Types.Constraint (Hole (..)) import GHC.Tc.Utils.Monad (getGblEnv, newTcRef)  import GHC.Plugin.OllamaHoles.Backend@@ -31,7 +32,17 @@ import GHC.Tc.Gen.App qualified as GHC (tcInferSigma) import GHC.Tc.Utils.TcType qualified as GHC (tyCoFVsOfType) import GHC.Types.SrcLoc qualified as GHC (mkRealSrcLoc)+#if __GLASGOW_HASKELL__ >= 908+import GHC.Tc.Types.Constraint (CtLocEnv(..))+#endif +#if __GLASGOW_HASKELL__ >= 912+import GHC.Tc.Types.CtLoc (ctLocEnv, ctLocSpan)+import qualified Data.Map as Map+#else+import GHC.Tc.Types.Constraint (ctLocEnv, ctLocSpan)+#endif+ -- | Prompt used to prompt the LLM promptTemplate :: Text promptTemplate =@@ -106,7 +117,11 @@                 liftIO $ when debug $ T.putStrLn $ "--- " <> pluginName <> ": Hole Found ---"                 let mn = "Module: " <> mod_name                 let lc = "Location: " <> showSDoc dflags (ppr $ ctLocSpan . hole_loc <$> th_hole hole)+#if __GLASGOW_HASKELL__ >= 912+                let im = "Imports: " <> showSDoc dflags (ppr $ Map.keys $ imp_mods imports)+#else                 let im = "Imports: " <> showSDoc dflags (ppr $ moduleEnvKeys $ imp_mods imports)+#endif                  case th_hole hole of                     Just h -> do@@ -114,7 +129,13 @@                         let hv = "Hole variable: _" <> occNameString (occName $ hole_occ h)                         let ht = "Hole type: " <> showSDoc dflags (ppr $ hole_ty h)                         let rc = "Relevant constraints: " <> showSDoc dflags (ppr $ th_relevant_cts hole)++#if __GLASGOW_HASKELL__ >= 908+                        let le = "Local environment (bindings): " <> showSDoc dflags (ppr $ ctl_rdr lcl_env)+#else                         let le = "Local environment (bindings): " <> showSDoc dflags (ppr $ tcl_rdr lcl_env)+#endif+                         let ge = "Global environment (bindings): " <> showSDoc dflags (ppr $ tcg_binds gbl_env)                         let cf = "Candidate fits: " <> showSDoc dflags (ppr fits)                         let prompt' =@@ -201,7 +222,7 @@ -- \| Remove lines between <think> and </think> tags from e.g. deepseek preProcess (ln : lns)     | T.isPrefixOf "<think>" ln =-        preProcess (tail $ dropWhile (not . T.isPrefixOf "</think>") lns)+        preProcess (drop 1 $ dropWhile (not . T.isPrefixOf "</think>") lns) preProcess (ln : lns) | should_drop = preProcess lns   where     should_drop :: Bool