Skip to content

Commit

Permalink
Merge pull request #4 from nuttycom/update_template_haskell
Browse files Browse the repository at this point in the history
Add compatibility with template-haskell up to 2.21
  • Loading branch information
nuttycom authored May 16, 2024
2 parents 29fe33c + 8f5edca commit 74775d0
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 12 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@
"8.6.1",
"8.8.1",
"8.10.1",
"9.0.1",
"9.2.1",
"9.4.1",
"9.6.1",
"9.8.1"
],
"os": [
"macos-13",
Expand Down
16 changes: 15 additions & 1 deletion Unsafe/TrueName.hs
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,15 @@ typNames typ = case typ of
#if MIN_VERSION_template_haskell(2,16,0)
ForallVisT _ t -> typNames t
#endif

#if MIN_VERSION_template_haskell(2,17,0)
MulArrowT -> []
#endif

#if MIN_VERSION_template_haskell(2,19,0)
PromotedInfixT s n t -> n : typNames s ++ typNames t
PromotedUInfixT s n t -> n : typNames s ++ typNames t
#endif
{- }}} -}

infoNames :: Info -> [Name]{- {{{ -}
Expand Down Expand Up @@ -347,7 +356,12 @@ truename = QuasiQuoter
_ -> err $ occString occ ++ " has a strange flavour"
makeP (name, vars) = if vars == [".."]
then RecP name . capture VarP <$> recFields name
else return $ ConP name (map pat vars) where
else
#if MIN_VERSION_template_haskell(2,18,0)
return $ ConP name [] (map pat vars) where
#else
return $ ConP name (map pat vars) where
#endif
pat n = case n of
"_" -> WildP
'!' : ns -> BangP (pat ns)
Expand Down
17 changes: 6 additions & 11 deletions true-name.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,8 @@ build-type: Simple
stability: experimental
tested-with:
GHC == 7.10.3,
GHC == 8.0.2,
GHC == 8.2.2,
GHC == 8.4.1,
GHC == 8.6.1,
GHC == 8.8.1,
GHC == 8.10.1
GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.1, GHC == 8.6.1, GHC == 8.8.1, GHC == 8.10.1,
GHC == 9.0.1, GHC == 9.2.1, GHC == 9.4.1, GHC == 9.6.1, GHC == 9.8.1,

source-repository head
type: git
Expand All @@ -36,14 +32,14 @@ source-repository head
common buildenv
default-language: Haskell2010
build-depends:
base ^>=4.8.2 || ^>=4.9.1 || ^>=4.10.1 || ^>=4.11.0 || ^>=4.12.0 || ^>=4.13.0 || ^>=4.14.0,
template-haskell ^>=2.10.0 || ^>=2.11.1 || ^>=2.12.0 || ^>=2.13.0 || ^>=2.14.0 || ^>=2.15.0 || ^>=2.16.0,
base ^>=4.8.2 || ^>=4.9.1 || ^>=4.10.1 || ^>=4.11.0 || ^>=4.12.0 || ^>=4.13.0 || ^>=4.14.0 || ^>=4.15.0 || ^>=4.16.0 || ^>=4.17.0 || ^>=4.18.0 || ^>=4.19.0,
template-haskell ^>=2.10.0 || ^>=2.11.1 || ^>=2.12.0 || ^>=2.13.0 || ^>=2.14.0 || ^>=2.15.0 || ^>=2.16.0 || ^>=2.17.0 || ^>=2.18.0 || ^>=2.19.0 || ^>=2.20.0 || ^>=2.21.0,
ghc-options: -Wall

library
import: buildenv
exposed-modules:
Unsafe.TrueName
ghc-options: -Wall

test-suite sanity
import: buildenv
Expand All @@ -52,9 +48,8 @@ test-suite sanity
main-is: sanity.hs
build-depends:
containers ^>=0.5.6 || ^>=0.6.0,
time ^>=1.1.2 || ^>=1.5.0 || ^>=1.6.0 || ^>=1.8.0 || ^>=1.9,
time ^>=1.1.2 || ^>=1.5.0 || ^>=1.6.0 || ^>=1.8.0 || ^>=1.9 || ^>=1.11.1 || ^>=1.12.2,
true-name,
ghc-options: -Wall

-- vim: et sw=4 ts=4 sts=4:

0 comments on commit 74775d0

Please sign in to comment.