Skip to content

Commit 9a5ee23

Browse files
ocharlescocreature
authored andcommitted
Build on GHC 8.8 (#43)
1 parent 7133f41 commit 9a5ee23

File tree

5 files changed

+16
-5
lines changed

5 files changed

+16
-5
lines changed

exe/Main.hs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ import GHC hiding (def)
4141
import qualified GHC.Paths
4242

4343
import HIE.Bios
44+
import HIE.Bios.Ghc.Api (initializeFlagsWithCradle)
4445

4546
-- Set the GHC libdir to the nix libdir if it's present.
4647
getLibdir :: IO FilePath
@@ -76,7 +77,7 @@ main = do
7677
-- Note that this whole section needs to change once we have genuine
7778
-- multi environment support. Needs rewriting in terms of loadEnvironment.
7879
putStrLn "[1/6] Finding hie-bios cradle"
79-
cradle <- findCradle (dir <> "/")
80+
cradle <- getCradle dir
8081
print cradle
8182

8283
putStrLn "\n[2/6] Converting Cradle to GHC session"
@@ -138,5 +139,13 @@ newSession' cradle = getLibdir >>= \libdir -> do
138139

139140
loadEnvironment :: FilePath -> IO (FilePath -> Action HscEnvEq)
140141
loadEnvironment dir = do
141-
res <- liftIO $ newSession' =<< findCradle (dir <> "/")
142+
res <- liftIO $ newSession' =<< getCradle dir
142143
return $ const $ return res
144+
145+
getCradle :: FilePath -> IO Cradle
146+
getCradle dir = do
147+
dir <- pure $ addTrailingPathSeparator dir
148+
mbYaml <- findCradle dir
149+
case mbYaml of
150+
Nothing -> loadImplicitCradle dir
151+
Just yaml -> loadCradle yaml

src/Development/IDE/GHC/Compat.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,12 @@ import System.IO
4040
import Foreign.ForeignPtr
4141

4242

43+
#if !MIN_GHC_API_VERSION(8,8,0)
4344
hPutStringBuffer :: Handle -> StringBuffer -> IO ()
4445
hPutStringBuffer hdl (StringBuffer buf len cur)
4546
= withForeignPtr (plusForeignPtr buf cur) $ \ptr ->
4647
hPutBuf hdl ptr len
48+
#endif
4749

4850
mkHieFile :: ModSummary -> TcGblEnv -> RenamedSource -> Hsc HieFile
4951
mkHieFile _ _ _ = return (HieFile () [])

stack-ghc-lib.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ extra-deps:
1010
- git: https://github.com/bubba/lsp-test.git
1111
commit: d126623dc6895d325e3d204d74e2a22d4f515587
1212
- git: https://github.com/mpickering/hie-bios.git
13-
commit: 89e4ba24f87aac9909d9814b0e8c51b679a0ccd4
13+
commit: 68c662ea1d0e7095ccf2a4e3d393fc524e769bfe
1414
- ghc-lib-parser-8.8.1
1515
- ghc-lib-8.8.1
1616
nix:

stack.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ extra-deps:
1111
- git: https://github.com/bubba/lsp-test.git
1212
commit: d126623dc6895d325e3d204d74e2a22d4f515587
1313
- git: https://github.com/mpickering/hie-bios.git
14-
commit: 89e4ba24f87aac9909d9814b0e8c51b679a0ccd4
14+
commit: 68c662ea1d0e7095ccf2a4e3d393fc524e769bfe
1515
nix:
1616
packages: [zlib]

stack84.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ extra-deps:
1515
- git: https://github.com/bubba/lsp-test.git
1616
commit: d126623dc6895d325e3d204d74e2a22d4f515587
1717
- git: https://github.com/mpickering/hie-bios.git
18-
commit: 89e4ba24f87aac9909d9814b0e8c51b679a0ccd4
18+
commit: 68c662ea1d0e7095ccf2a4e3d393fc524e769bfe
1919
nix:
2020
packages: [zlib]
2121
allow-newer: true

0 commit comments

Comments
 (0)