diff --git a/ihaskell.cabal b/ihaskell.cabal index d29ca5b7..7cbd518a 100644 --- a/ihaskell.cabal +++ b/ihaskell.cabal @@ -49,6 +49,11 @@ data-files: jupyterlab-ihaskell/labextension/static/*.js jupyterlab-ihaskell/labextension/static/*.json +flag use-hlint + description: Include HLint support + default: True + manual: True + library hs-source-dirs: src default-language: Haskell2010 @@ -72,7 +77,6 @@ library ghc-parser >=0.2.1, ghc-paths >=0.1, haskeline -any, - hlint >=1.9, http-client >= 0.4, http-client-tls >= 0.2, mtl >=2.1, @@ -93,10 +97,6 @@ library ipython-kernel >=0.10.2.0, ghc-boot >=8.0 && <9.1 - if impl (ghc < 8.10) - build-depends: - haskell-src-exts >=1.18 - exposed-modules: IHaskell.Display IHaskell.Convert IHaskell.Convert.Args @@ -106,7 +106,6 @@ library IHaskell.Eval.Inspect IHaskell.Eval.Evaluate IHaskell.Eval.Info - IHaskell.Eval.Lint IHaskell.Eval.Parser IHaskell.Eval.Hoogle IHaskell.Eval.ParseShell @@ -124,6 +123,14 @@ library other-modules: StringUtils + if flag(use-hlint) + exposed-modules: IHaskell.Eval.Lint + build-depends: hlint >=1.9 + cpp-options: -DUSE_HLINT + + if flag(use-hlint) && impl (ghc < 8.10) + build-depends: haskell-src-exts >=1.18 + executable ihaskell -- .hs or .lhs file containing the Main module. main-is: Main.hs diff --git a/src/IHaskell/Eval/Evaluate.hs b/src/IHaskell/Eval/Evaluate.hs index 4c5c983d..69a76a19 100644 --- a/src/IHaskell/Eval/Evaluate.hs +++ b/src/IHaskell/Eval/Evaluate.hs @@ -68,13 +68,16 @@ import GHC hiding (Stmt, TypeSig) import IHaskell.Types import IHaskell.IPython import IHaskell.Eval.Parser -import IHaskell.Eval.Lint import IHaskell.Display import qualified IHaskell.Eval.Hoogle as Hoogle import IHaskell.Eval.Util import IHaskell.BrokenPackages import StringUtils (replace, split, strip, rstrip) +#ifdef USE_HLINT +import IHaskell.Eval.Lint +#endif + #if MIN_VERSION_ghc(9,0,0) import GHC.Data.FastString #elif MIN_VERSION_ghc(8,2,0) @@ -351,10 +354,13 @@ evaluate kernelState code output widgetHandler = do updated <- case errs of -- Only run things if there are no parse errors. [] -> do + +#ifdef USE_HLINT when (getLintStatus kernelState /= LintOff) $ liftIO $ do lintSuggestions <- lint code cmds unless (noResults lintSuggestions) $ output (FinalResult lintSuggestions [] []) Success +#endif runUntilFailure kernelState (map unloc cmds ++ [storeItCommand execCount]) -- Print all parse errors.