Ghc 8.8.1 support

This commit is contained in:
Avi Dessauer 2019-12-18 07:49:20 -05:00
parent 2c51b612d4
commit a2eab3c9ac
9 changed files with 63 additions and 35 deletions

4
.gitmodules vendored
View File

@ -13,3 +13,7 @@
[submodule "submodules/cabal-helper"]
path = submodules/cabal-helper
url = https://github.com/DanielG/cabal-helper.git
[submodule "submodules/apply-refact"]
path = submodules/apply-refact
url = https://github.com/mpickering/apply-refact.git

View File

@ -14,7 +14,7 @@ build-type: Simple
cabal-version: >=2.0
flag pedantic
Description: Enable -Werror
Description: Enable -Werror -Wwarn=unused-imports
Default: False
library
@ -101,7 +101,7 @@ library
ghc-options: -Wall -Wredundant-constraints
if flag(pedantic)
ghc-options: -Werror
ghc-options: -Werror -Wwarn=unused-imports
default-language: Haskell2010
executable hie
@ -120,7 +120,7 @@ executable hie
ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall -Wredundant-constraints
-with-rtsopts=-T
if flag(pedantic)
ghc-options: -Werror
ghc-options: -Werror -Wwarn=unused-imports
default-language: Haskell2010
@ -141,7 +141,7 @@ executable hie-wrapper
ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall -Wredundant-constraints
-with-rtsopts=-T
if flag(pedantic)
ghc-options: -Werror
ghc-options: -Werror -Wwarn=unused-imports
default-language: Haskell2010
library hie-test-utils
@ -167,7 +167,7 @@ library hie-test-utils
, yaml
ghc-options: -Wall -Wredundant-constraints
if flag(pedantic)
ghc-options: -Werror
ghc-options: -Werror -Wwarn=unused-imports
default-language: Haskell2010
test-suite unit-test
@ -211,7 +211,7 @@ test-suite unit-test
ghc-options: -Wall -Wredundant-constraints
if flag(pedantic)
ghc-options: -Werror
ghc-options: -Werror -Wwarn=unused-imports
default-language: Haskell2010
test-suite dispatcher-test
@ -235,7 +235,7 @@ test-suite dispatcher-test
ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall -Wredundant-constraints
if flag(pedantic)
ghc-options: -Werror
ghc-options: -Werror -Wwarn=unused-imports
default-language: Haskell2010
build-tool-depends: hspec-discover:hspec-discover
@ -255,7 +255,7 @@ test-suite plugin-dispatcher-test
ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall -Wredundant-constraints
if flag(pedantic)
ghc-options: -Werror
ghc-options: -Werror -Wwarn=unused-imports
default-language: Haskell2010
test-suite func-test
@ -300,7 +300,7 @@ test-suite func-test
, containers
ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall -Wredundant-constraints
if flag(pedantic)
ghc-options: -Werror
ghc-options: -Werror -Wwarn=unused-imports
default-language: Haskell2010
build-tool-depends: hspec-discover:hspec-discover
, haskell-ide-engine:hie
@ -319,7 +319,7 @@ test-suite wrapper-test
, hie-plugin-api
ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall -Wredundant-constraints
if flag(pedantic)
ghc-options: -Werror
ghc-options: -Werror -Wwarn=unused-imports
default-language: Haskell2010

View File

@ -1,5 +1,5 @@
# Used to provide a different environment for the shake build script
resolver: lts-14.11 # GHC 8.6.5
resolver: lts-14.17 # GHC 8.6.5
packages:
- .

View File

@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -107,7 +108,11 @@ getDocsForName df name = do
case mf of
Nothing -> return Nothing
Just f -> do
#if __GLASGOW_HASKELL__ >= 808
ehi <- readInterfaceFile nameCacheFromIdeM f True
#else
ehi <- readInterfaceFile nameCacheFromIdeM f
#endif
case ehi of
Left message -> do
debugm $ "Haddock docs couldn't be loaded as readInterfaceFile failed with: " ++ message
@ -152,8 +157,15 @@ prettyprintType n t = T.unlines
, "```\n"
]
unwrap :: Foldable w => w a -> a
unwrap = foldl1 (const id)
renderDocs :: MDoc Name -> T.Text
#if __GLASGOW_HASKELL__ >= 808
renderDocs = markup renderMarkDown . _doc . fmap unwrap
#else
renderDocs = markup renderMarkDown . _doc
#endif
renderMarkDown :: DocMarkup Name T.Text
renderMarkDown =
@ -162,7 +174,11 @@ renderMarkDown =
, markupParagraph = (<> "\n\n")
, markupAppend = mappend
, markupIdentifier = surround "`" . T.pack . getOccString
#if __GLASGOW_HASKELL__ >= 808
, markupIdentifierUnchecked = T.pack . occNameString . snd . unwrap
#else
, markupIdentifierUnchecked = T.pack . occNameString . snd
#endif
, markupModule = surround "**" . T.pack
, markupWarning = surround "*"
, markupEmphasis = surround "*"
@ -174,9 +190,16 @@ renderMarkDown =
, markupDefList = T.unlines . map (\(a, b) -> a <> " :: " <> b)
, markupCodeBlock = \x -> "\n```haskell\n" <> removeInner x <> "\n```\n"
, markupHyperlink = \h ->
T.pack $ maybe
#if __GLASGOW_HASKELL__ >= 808
let url = T.pack $ hyperlinkUrl h
in maybe
url
(\l -> "["<>l<>"]("<>url<>")")
#else
T.pack $ maybe
(hyperlinkUrl h)
(\l -> "["<>l<>"]("<>hyperlinkUrl h<>")")
#endif
(hyperlinkLabel h)
, markupAName = T.pack
, markupPic = const ""

View File

@ -22,6 +22,7 @@ import qualified Data.ByteString as B
import Data.Foldable
import Data.List
import qualified Data.HashMap.Strict as HM
import qualified Data.Set as S
import qualified Data.Text as T
import qualified Data.Text.Encoding as T
import Data.Maybe
@ -297,7 +298,11 @@ editCabalPackage file modulePath pkgName fileMap = do
-- Add it to the bottom of the dependencies list
-- TODO: we could sort the depencies and then insert it,
-- or insert it in order iff the list is already sorted.
#if __GLASGOW_HASKELL__ >= 808
newDeps = oldDeps ++ [Dependency (mkPackageName (T.unpack dep)) anyVersion S.empty]
#else
newDeps = oldDeps ++ [Dependency (mkPackageName (T.unpack dep)) anyVersion]
#endif
-- | Provide a code action to add a package to the local package.yaml or cabal file.
-- Reads from diagnostics the unknown import module path and searches for it on Hoogle.

View File

@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE ScopedTypeVariables #-}
@ -336,7 +337,11 @@ gotoModule rfm mn = do
flushFinderCaches env
findImportedModule env mn Nothing
case fr of
#if __GLASGOW_HASKELL__ < 808
Found (ModLocation (Just src) _ _) _ -> do
#else
Found (ModLocation (Just src) _ _ _) _ -> do
#endif
fp <- reverseMapFile rfm src
let r = Range (Position 0 0) (Position 0 0)

View File

@ -1,4 +1,4 @@
resolver: lts-14.16
resolver: lts-14.17
packages:
- .
- hie-plugin-api

View File

@ -1,4 +1,4 @@
resolver: nightly-2019-09-21 # Last GHC 8.6.5
resolver: nightly-2019-12-18
packages:
- .
- hie-plugin-api
@ -6,31 +6,21 @@ packages:
extra-deps:
# - ./submodules/HaRe
- ./submodules/cabal-helper
- ./submodules/apply-refact
- deque-0.4.3
- ansi-terminal-0.8.2
- bytestring-trie-0.2.5.0
- ansi-wl-pprint-0.6.8.2
- brittany-0.12.1.0
- cabal-plan-0.5.0.0
- constrained-dynamic-0.1.0.0
- floskell-0.10.2
- ghc-lib-parser-8.8.1
- haddock-api-2.22.0
- haskell-lsp-0.19.0.0
- haskell-lsp-types-0.19.0.0
- hie-bios-0.3.2
- hlint-2.2.4
- bytestring-trie-0.2.5.0
- constrained-dynamic-0.1.0.0
- fclabels-2.0.3.3
- floskell-0.10.2
- fold-debounce-0.2.0.9
- haddock-api-2.23.0
- haddock-library-1.8.0
- hoogle-5.0.17.13
- hsimport-0.11.0
- lsp-test-0.9.0.0
- monad-dijkstra-0.1.1.2@rev:1
- syz-0.2.0.0
- temporary-1.2.1.1
- clock-0.7.2
- ghc-exactprint-0.6.2 # for HaRe
- extra-1.6.18
- unix-compat-0.5.2
- yaml-0.11.1.2
- monad-dijkstra-0.1.1.2
flags:
haskell-ide-engine:
@ -39,7 +29,7 @@ flags:
pedantic: true
# allow-newer: true
allow-newer: true
nix:
packages: [ icu libcxx zlib ]

@ -0,0 +1 @@
Subproject commit 1acf7eb860be5a446828a3a2fe3644aeb5a1b55f