Skip to content

Commit 722df97

Browse files
committed
fix(eventlog-live-otelcol): add automatic flag to switch between using template-haskell and template-haskell-lift
1 parent a5174d3 commit 722df97

4 files changed

Lines changed: 31 additions & 3 deletions

File tree

eventlog-live-otelcol/eventlog-live-otelcol.cabal

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,14 @@ source-repository head
8888
location: https://github.com/well-typed/eventlog-live.git
8989
subdir: eventlog-live-otelcol
9090

91+
-- 2025-11-06:
92+
-- This flag should enable switching between template-haskell and
93+
-- template-haskell-lift, because the latter is not on nixpkgs.
94+
flag use-template-haskell-lift
95+
description: Use template-haskell-lift in place of template-haskell
96+
default: False
97+
manual: False
98+
9199
common language
92100
ghc-options:
93101
-Wall -Wcompat -Widentities -Wprepositive-qualified-module
@@ -140,6 +148,7 @@ library
140148
GHC.Eventlog.Live.Otelcol.Config.Default
141149
GHC.Eventlog.Live.Otelcol.Config.Default.Raw
142150
GHC.Eventlog.Live.Otelcol.Config.Types
151+
Language.Haskell.TH.Lift.Compat
143152
Options.Applicative.Compat
144153
Paths_eventlog_live_otelcol
145154
System.Random.Compat
@@ -167,12 +176,18 @@ library
167176
, random >=1.2 && <1.4
168177
, strict-list >=0.1 && <0.2
169178
, table-layout >=1.0 && <1.1
170-
, template-haskell-lift >=0.1 && <0.2
171179
, text >=1.2 && <2.2
172180
, unordered-containers >=0.2.20 && <0.3
173181
, vector >=0.11 && <0.14
174182
, yaml >=0.11 && <0.12
175183

184+
if flag(use-template-haskell-lift)
185+
build-depends: template-haskell-lift >=0.1 && <0.2
186+
cpp-options: -DEVENTLOG_LIVE_OTELCOL_USE_TEMPLATE_HASKELL_LIFT
187+
188+
else
189+
build-depends: template-haskell >=2.2 && <3.0
190+
176191
executable eventlog-live-otelcol
177192
import: language
178193
main-is: Main.hs

eventlog-live-otelcol/src/GHC/Eventlog/Live/Otelcol/Config/Default.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import GHC.Eventlog.Live.Otelcol.Config.Default.Raw (defaultConfigByteString)
2727
import GHC.Eventlog.Live.Otelcol.Config.Types (Config)
2828
import GHC.Records (HasField (..))
2929
import GHC.TypeLits (KnownSymbol, Symbol, symbolVal)
30-
import Language.Haskell.TH.Lift (Exp, Lift (..), Q)
30+
import Language.Haskell.TH.Lift.Compat (Exp, Lift (..), Q)
3131

3232
{- |
3333
Internal helper.

eventlog-live-otelcol/src/GHC/Eventlog/Live/Otelcol/Config/Types.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ module GHC.Eventlog.Live.Otelcol.Config.Types (
2626
import Data.Aeson.Types (Encoding, FromJSON (..), Options (..), Parser, SumEncoding (..), ToJSON (..), Value (..), camelTo2, defaultOptions, genericParseJSON, genericToEncoding, genericToJSON)
2727
import Data.Text (Text)
2828
import GHC.Generics (Generic)
29-
import Language.Haskell.TH.Lift (Lift)
29+
import Language.Haskell.TH.Lift.Compat (Lift)
3030

3131
{- |
3232
The configuration for @eventlog-live-otelcol@.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{-# LANGUAGE CPP #-}
2+
3+
module Language.Haskell.TH.Lift.Compat (
4+
Exp,
5+
Lift (..),
6+
Q,
7+
) where
8+
9+
#if defined(EVENTLOG_LIVE_OTELCOL_USE_TEMPLATE_HASKELL_LIFT)
10+
import Language.Haskell.TH.Lift (Exp, Lift (..), Q)
11+
#else
12+
import Language.Haskell.TH.Syntax (Exp, Lift (..), Q)
13+
#endif

0 commit comments

Comments
 (0)