diff --git a/src/HieDb/Compat.hs b/src/HieDb/Compat.hs index db179d4..1f3624e 100644 --- a/src/HieDb/Compat.hs +++ b/src/HieDb/Compat.hs @@ -1,5 +1,5 @@ -{-# LANGUAGE CPP, PatternSynonyms, ViewPatterns #-} +{-# LANGUAGE CPP, PatternSynonyms, ViewPatterns, TupleSections #-} module HieDb.Compat ( nodeInfo' , Unit @@ -185,7 +185,9 @@ hiePathToFS fs = fs {-# COMPLETE AvailTC, AvailName, AvailFL #-} pattern AvailTC :: Name -> [Name] -> [FieldLabel] -> Avail.AvailInfo -#if __GLASGOW_HASKELL__ >= 902 +#if __GLASGOW_HASKELL__ >= 907 +pattern AvailTC n names pieces <- Avail.AvailTC n ((,[]) -> (names,pieces)) +#elif __GLASGOW_HASKELL__ >= 902 pattern AvailTC n names pieces <- Avail.AvailTC n ((\gres -> foldr (\gre (names, pieces) -> case gre of Avail.NormalGreName name -> (name: names, pieces) Avail.FieldGreName label -> (names, label:pieces)) ([], []) gres) -> (names, pieces)) @@ -194,14 +196,18 @@ pattern AvailTC n names pieces <- Avail.AvailTC n names pieces #endif pattern AvailName :: Name -> Avail.AvailInfo -#if __GLASGOW_HASKELL__ >= 902 +#if __GLASGOW_HASKELL__ >= 907 +pattern AvailName n <- Avail.Avail n +#elif __GLASGOW_HASKELL__ >= 902 pattern AvailName n <- Avail.Avail (Avail.NormalGreName n) #else pattern AvailName n <- Avail.Avail n #endif pattern AvailFL :: FieldLabel -> Avail.AvailInfo -#if __GLASGOW_HASKELL__ >= 902 +#if __GLASGOW_HASKELL__ >= 907 +pattern AvailFL fl <- (const Nothing -> Just fl) -- this pattern always fails as this field was removed in 9.7 +#elif __GLASGOW_HASKELL__ >= 902 pattern AvailFL fl <- Avail.Avail (Avail.FieldGreName fl) #else -- pattern synonym that is never populated diff --git a/src/HieDb/Utils.hs b/src/HieDb/Utils.hs index 1c4e3d2..afa5918 100644 --- a/src/HieDb/Utils.hs +++ b/src/HieDb/Utils.hs @@ -1,4 +1,5 @@ {-# LANGUAGE BlockArguments #-} +{-# LANGUAGE TupleSections #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE DisambiguateRecordFields #-} {-# LANGUAGE FlexibleContexts #-}