Skip to content

Commit

Permalink
Remove unused pre-8.0 code paths
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanGlScott committed Sep 20, 2024
1 parent 5166851 commit 47dd226
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 426 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/haskell-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
#
# haskell-ci regenerate
#
# For more information, see https://github.com/andreasabel/haskell-ci
# For more information, see https://github.com/haskell-CI/haskell-ci
#
# version: 0.19.20240703
# version: 0.19.20240708
#
# REGENDATA ("0.19.20240703",["github","--config=cabal.haskell-ci","cabal.project"])
# REGENDATA ("0.19.20240708",["github","--config=cabal.haskell-ci","cabal.project"])
#
name: Haskell-CI
on:
Expand Down Expand Up @@ -95,7 +95,7 @@ jobs:
apt-get update
apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5 libnuma-dev
mkdir -p "$HOME/.ghcup/bin"
curl -sL https://downloads.haskell.org/ghcup/0.1.20.0/x86_64-linux-ghcup-0.1.20.0 > "$HOME/.ghcup/bin/ghcup"
curl -sL https://downloads.haskell.org/ghcup/0.1.30.0/x86_64-linux-ghcup-0.1.30.0 > "$HOME/.ghcup/bin/ghcup"
chmod a+x "$HOME/.ghcup/bin/ghcup"
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false)
"$HOME/.ghcup/bin/ghcup" install cabal 3.12.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.markdown
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
next [????.??.??]
-----------------
* Drop support for GHC 7.10 and earlier.

0.8.8 [2023.08.08]
------------------
* Allow building with GHC 9.8.
Expand Down
1 change: 0 additions & 1 deletion cabal.haskell-ci
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
distribution: jammy
no-tests-no-benchmarks: False
unconstrained: False
-- allow-failures: <7.3
-- irc-channels: irc.freenode.org#haskell-lens
-- irc-if-in-origin-repo: True
279 changes: 0 additions & 279 deletions old/Data/Proxy.hs

This file was deleted.

33 changes: 5 additions & 28 deletions src/Data/Proxy/TH.hs
Original file line number Diff line number Diff line change
@@ -1,44 +1,27 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE TemplateHaskellQuotes #-}
#ifndef MIN_VERSION_template_haskell
#define MIN_VERSION_template_haskell(x,y,z) 1
#endif
-- template-haskell is only safe since GHC-8.2
#if __GLASGOW_HASKELL__ >= 802
{-# LANGUAGE Safe #-}
#elif __GLASGOW_HASKELL__ >= 702
#else
{-# LANGUAGE Trustworthy #-}
#endif
module Data.Proxy.TH
( pr
#if MIN_VERSION_template_haskell(2,8,0)
, pr1
#endif
) where

import Data.Char
#if __GLASGOW_HASKELL__ < 710
import Data.Functor
#endif
#if __GLASGOW_HASKELL__ < 707
import Data.Version (showVersion)
import Paths_tagged
#endif
import Data.Proxy (Proxy(..))
import Language.Haskell.TH
import Language.Haskell.TH.Quote
import Language.Haskell.TH.Syntax

proxy_d, proxy_tc :: Name
#if __GLASGOW_HASKELL__ >= 707
proxy_d = mkNameG_d "base" "Data.Proxy" "Proxy"
proxy_tc = mkNameG_tc "base" "Data.Proxy" "Proxy"
#else
proxy_d = mkNameG_d taggedPackageKey "Data.Proxy" "Proxy"
proxy_tc = mkNameG_tc taggedPackageKey "Data.Proxy" "Proxy"

-- note: On 7.10+ this would use CURRENT_PACKAGE_KEY if we still housed the key.
taggedPackageKey :: String
taggedPackageKey = "tagged-" ++ showVersion version
#endif
proxy_d = 'Proxy
proxy_tc = ''Proxy

proxyTypeQ :: TypeQ -> TypeQ
proxyTypeQ t = appT (conT proxy_tc) t
Expand All @@ -61,17 +44,12 @@ pr = QuasiQuoter (mkProxy proxyExpQ) (mkProxy proxyPatQ) (mkProxy proxyTypeQ) un
[h@(t:_)]
| isUpper t -> p $ conT $ mkName h
| otherwise -> p $ varT $ mkName h
#if MIN_VERSION_template_haskell(2,8,0)
_ -> p $ mkList <$> cons
#endif
where
ts = map strip $ splitOn ',' s
cons = mapM (conT . mkName) ts
#if MIN_VERSION_template_haskell(2,8,0)
mkList = foldr (AppT . AppT PromotedConsT) PromotedNilT
#endif

#if MIN_VERSION_template_haskell(2,8,0)
-- | Like 'pr', but takes a single type, which is used to produce a
-- 'Proxy' for a single-element list containing only that type. This
-- is useful for passing a single type to a function that wants a list
Expand All @@ -86,7 +64,6 @@ pr1 = QuasiQuoter (mkProxy proxyExpQ) (mkProxy proxyPatQ) (mkProxy proxyTypeQ) u
| isUpper t -> p (fmap sing (conT $ mkName s))
| otherwise -> p (fmap sing (varT $ mkName s))
_ -> error "Empty string passed to pr1"
#endif

-- | Split on a delimiter.
splitOn :: Eq a => a -> [a] -> [[a]]
Expand Down
Loading

0 comments on commit 47dd226

Please sign in to comment.