Only import and run htmlify for GHC >= 8.4.0

This commit is contained in:
thomasjm 2023-08-10 22:44:41 -07:00
parent 7a8d728ad1
commit 57fa0fe504
2 changed files with 7 additions and 2 deletions

View File

@ -61,6 +61,7 @@ library
if impl (ghc >= 8.4)
ghc-options: -Wpartial-fields
build-depends: ghc-syntax-highlighter
build-depends:
base >=4.9 && <4.19,
@ -72,7 +73,6 @@ library
filepath ,
ghc >=8.0 && <9.7,
ghc-boot ,
ghc-syntax-highlighter,
haskeline ,
parsec ,
process ,

View File

@ -98,7 +98,6 @@ import IHaskell.Types
import IHaskell.IPython
import IHaskell.Eval.Parser
import IHaskell.Display
import IHaskell.Eval.Evaluate.HTML (htmlify)
import qualified IHaskell.Eval.Hoogle as Hoogle
import IHaskell.Eval.Util
import IHaskell.BrokenPackages
@ -108,6 +107,10 @@ import StringUtils (replace, split, strip, rstrip)
import IHaskell.Eval.Lint
#endif
#if MIN_VERSION_ghc(8,4,0)
import IHaskell.Eval.Evaluate.HTML (htmlify)
#endif
#if MIN_VERSION_ghc(9,0,0)
import GHC.Data.FastString
#elif MIN_VERSION_ghc(8,2,0)
@ -938,9 +941,11 @@ evalCommand _ (Directive GetInfo str) state = safely state $ do
{ evalStatus = Success
, evalResult = Display [
plain strings
#if MIN_VERSION_ghc(8,4,0)
, htmlify (Text.pack <$> htmlCodeWrapperClass state)
(Text.pack $ htmlCodeTokenPrefix state)
strings
#endif
]
, evalState = state
, evalPager = []