Skip to content

Commit 3007831

Browse files
committed
Preliminary ghc-9.14 support
Currently using ghc-9.14.0.20251007.
1 parent 1632f51 commit 3007831

File tree

7 files changed

+284
-14
lines changed

7 files changed

+284
-14
lines changed

cabal.project

Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,208 @@ allow-newer:
8383
-- https://github.com/IntersectMBO/plutus/pull/7236
8484
constraints: setup.optparse-applicative >=0.19.0.0
8585
allow-newer: turtle:optparse-applicative
86+
87+
if impl (ghc >= 9.14)
88+
-- https://github.com/snowleopard/alga/issues/322
89+
source-repository-package
90+
type: git
91+
location: https://github.com/snowleopard/alga/
92+
tag: d4e43fb42db05413459fb2df493361d5a666588a
93+
94+
if impl (ghc >= 9.14)
95+
constraints:
96+
, nothunks ^>= 0.2
97+
, microlens ^>= 0.4
98+
, microlens-mtl < 0.2.1.1
99+
, microlens-th < 0.4.3.18
100+
-- Newest version causes Arbitrary instance clashes in quickcheck-instances.
101+
, QuickCheck < 2.17.0.0
102+
103+
-- cabal-allow-newer
104+
if impl (ghc >= 9.14)
105+
allow-newer:
106+
, Cabal:Cabal-syntax
107+
, Cabal:containers
108+
, Cabal-syntax:containers
109+
, OneTuple:base
110+
, QuickCheck:base
111+
, QuickCheck:splitmix
112+
, aeson:OneTuple
113+
, aeson:containers
114+
, aeson:data-fix
115+
, aeson:ghc-prim
116+
, aeson:indexed-traversable
117+
, aeson:scientific
118+
, aeson:semialign
119+
, aeson:template-haskell
120+
, aeson:text-iso8601
121+
, aeson:these
122+
, aeson:time
123+
, aeson:time-compat
124+
, aeson:witherable
125+
, assoc:base
126+
, async:base
127+
, base:ghc-internal
128+
, base:ghc-prim
129+
, bifunctors:template-haskell
130+
, bin:base
131+
, binary:containers
132+
, binary-orphans:base
133+
, boring:base
134+
, brick:base
135+
, canonical-json:containers
136+
, cardano-crypto-class:io-classes
137+
, cborg:base
138+
, cborg:containers
139+
, cborg:ghc-prim
140+
, concurrent-output:process
141+
, config-ini:containers
142+
, config-ini:text
143+
, constraints-extras:base
144+
, constraints-extras:template-haskell
145+
, containers:base
146+
, containers:template-haskell
147+
, criterion:aeson
148+
, data-default:containers
149+
, data-default-class:data-default
150+
, data-fix:base
151+
, dec:base
152+
, deepseq:base
153+
, deepseq:ghc-prim
154+
, dependent-map:containers
155+
, deriving-compat:containers
156+
, deriving-compat:template-haskell
157+
, dictionary-sharing:containers
158+
, directory:base
159+
, directory:time
160+
, dom-lt:containers
161+
, fin:base
162+
, fin:universe-base
163+
, foldl:containers
164+
, free:containers
165+
, free:template-haskell
166+
, generically:base
167+
, ghc-heap:containers
168+
, ghc-heap:ghc-internal
169+
, hashable:base
170+
, hashable:containers
171+
, hashable:ghc-bignum
172+
, hedgehog:containers
173+
, hedgehog:template-haskell
174+
, hedgehog:time
175+
, hedgehog-fn:hedgehog
176+
, hsc2hs:base
177+
, indexed-traversable:base
178+
, indexed-traversable:containers
179+
, indexed-traversable-instances:base
180+
, integer-conversion:base
181+
, integer-logarithms:base
182+
, integer-logarithms:ghc-bignum
183+
, io-classes:base
184+
, io-classes:time
185+
, lens:containers
186+
, lens:free
187+
, lens:template-haskell
188+
, list-t:foldl
189+
, megaparsec:base
190+
, megaparsec:containers
191+
, megaparsec:transformers
192+
, microlens-th:containers
193+
, microlens-th:template-haskell
194+
, microstache:aeson
195+
, microstache:base
196+
, microstache:containers
197+
, microstache:unordered-containers
198+
, microstache:vector
199+
, monoidal-containers:base
200+
, monoidal-containers:containers
201+
, network-uri:th-compat
202+
, nonempty-vector:base
203+
, nothunks:containers
204+
, nothunks:time
205+
, nothunks:wherefrom-compat
206+
, ordered-containers:containers
207+
, os-string:template-haskell
208+
, parallel:base
209+
, parsec:text
210+
, plutus-core:dependent-map
211+
, plutus-core:microlens-th
212+
, plutus-core:vty
213+
, primitive:base
214+
, process:base
215+
, process:unix
216+
, quickcheck-instances:QuickCheck
217+
, quickcheck-instances:base
218+
, quickcheck-instances:containers
219+
, ral:base
220+
, ral:boring
221+
, recursion-schemes:containers
222+
, recursion-schemes:template-haskell
223+
, scientific:base
224+
, scientific:containers
225+
, scientific:integer-logarithms
226+
, scientific:template-haskell
227+
, semialign:base
228+
, semialign:containers
229+
, semigroupoids:bifunctors
230+
, serialise:base
231+
, serialise:containers
232+
, serialise:ghc-prim
233+
, serialise:time
234+
, singletons:base
235+
, singletons-th:base
236+
, singletons-th:singletons
237+
, singletons-th:template-haskell
238+
, singletons-th:th-desugar
239+
, singletons-th:th-orphans
240+
, size-based:template-haskell
241+
, some:base
242+
, splitmix:base
243+
, statistics:parallel
244+
, tagged:base
245+
, tagged:template-haskell
246+
, tasty:base
247+
, tasty:tagged
248+
, tasty-golden:tasty
249+
, tasty-hedgehog:base
250+
, test-framework:time
251+
, text:binary
252+
, text:bytestring
253+
, text:template-haskell
254+
, text-iso8601:time
255+
, text-short:base
256+
, text-short:bytestring
257+
, text-short:ghc-prim
258+
, text-short:template-haskell
259+
, th-abstraction:template-haskell
260+
, th-compat:template-haskell
261+
, th-desugar:template-haskell
262+
, th-expand-syns:base
263+
, th-expand-syns:containers
264+
, th-expand-syns:template-haskell
265+
, th-lift:template-haskell
266+
, th-lift-instances:th-lift
267+
, th-orphans:template-haskell
268+
, these:base
269+
, time-compat:base
270+
, time-compat:deepseq
271+
, time-compat:time
272+
, transformers:base
273+
, tree-diff:QuickCheck
274+
, tree-diff:base
275+
, tree-diff:containers
276+
, tree-diff:time
277+
, turtle:containers
278+
, turtle:time
279+
, typed-process:async
280+
, universe-base:base
281+
, universe-base:containers
282+
, unix:time
283+
, unordered-containers:hashable
284+
, unordered-containers:template-haskell
285+
, uuid-types:template-haskell
286+
, vector-th-unbox:base
287+
, vector-th-unbox:template-haskell
288+
, wherefrom-compat:base
289+
, wherefrom-compat:ghc-heap
290+
, witherable:containers

plutus-core/plutus-core/src/PlutusCore/Core/Instance/Eq.hs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
{-# OPTIONS_GHC -fno-warn-orphans #-}
55

6+
{-# LANGUAGE CPP #-}
67
{-# LANGUAGE FlexibleInstances #-}
78
{-# LANGUAGE RankNTypes #-}
89
{-# LANGUAGE TypeApplications #-}
@@ -51,9 +52,14 @@ deriving stock instance
5152
(GEq uni, Closed uni, uni `Everywhere` Eq, Eq ann) =>
5253
Eq (Type TyDeBruijn uni ann)
5354

54-
deriving stock instance (GEq uni, Closed uni, uni `Everywhere` Eq, Eq fun, Eq ann,
55-
Eq (Term tyname name uni fun ann)
56-
) => Eq (Program tyname name uni fun ann)
55+
deriving stock instance (
56+
#if __GLASGOW_HASKELL__ < 914
57+
-- These constraints are REQUIRED for ghc < 9.14 but REDUNDANT for ghc >= 9.14
58+
-- See https://gitlab.haskell.org/ghc/ghc/-/issues/26381#note_637863
59+
GEq uni, Closed uni, Eq fun,
60+
#endif
61+
uni `Everywhere` Eq, Eq ann,
62+
Eq (Term tyname name uni fun ann) ) => Eq (Program tyname name uni fun ann)
5763

5864
type EqRenameOf ren a = HasUniques a => a -> a -> EqRename ren
5965

plutus-core/plutus-core/src/PlutusCore/Error.hs

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{-# LANGUAGE CPP #-}
12
{-# LANGUAGE DeriveAnyClass #-}
23
{-# LANGUAGE FlexibleInstances #-}
34
{-# LANGUAGE FunctionalDependencies #-}
@@ -84,8 +85,13 @@ deriving stock instance
8485
deriving stock instance
8586
( Eq (Term tyname name uni fun ann)
8687
, Eq (Type tyname uni ann)
87-
, GEq uni, Closed uni, uni `Everywhere` Eq
88-
, Eq fun, Eq ann
88+
#if __GLASGOW_HASKELL__ < 914
89+
-- These constraints are REQUIRED for ghc < 9.14 but REDUNDANT for ghc >= 9.14
90+
-- See https://gitlab.haskell.org/ghc/ghc/-/issues/26381#note_637863
91+
, GEq uni, Closed uni
92+
, Eq fun
93+
#endif
94+
, uni `Everywhere` Eq, Eq ann
8995
) => Eq (NormCheckError tyname name uni fun ann)
9096

9197
-- | This is needed for nice kind/type checking error messages. In some cases the type checker knows
@@ -151,15 +157,33 @@ data Error uni fun ann
151157
deriving stock (Generic, Functor)
152158

153159
deriving stock instance
154-
(Eq fun, Eq ann, Closed uni, Everywhere uni Eq, GEq uni, Eq ParserError) =>
160+
(Eq fun, Eq ann, Closed uni, Everywhere uni Eq, GEq uni
161+
#if __GLASGOW_HASKELL__ < 914
162+
-- These constraints are REQUIRED for ghc < 9.14 but REDUNDANT for ghc >= 9.14
163+
-- See https://gitlab.haskell.org/ghc/ghc/-/issues/26381#note_637863
164+
, Eq ParserError
165+
#endif
166+
) =>
155167
Eq (Error uni fun ann)
156168

157169
deriving anyclass instance
158-
(NFData fun, NFData ann, Closed uni, Everywhere uni NFData, NFData ParserError) =>
170+
(NFData fun, NFData ann, Closed uni, Everywhere uni NFData
171+
#if __GLASGOW_HASKELL__ < 914
172+
-- These constraints are REQUIRED for ghc < 9.14 but REDUNDANT for ghc >= 9.14
173+
-- See https://gitlab.haskell.org/ghc/ghc/-/issues/26381#note_637863
174+
, NFData ParserError
175+
#endif
176+
) =>
159177
NFData (Error uni fun ann)
160178

161179
deriving stock instance
162-
(Show fun, Show ann, Closed uni, Everywhere uni Show, GShow uni, Show ParserError) =>
180+
(Show fun, Show ann, Closed uni, Everywhere uni Show, GShow uni
181+
#if __GLASGOW_HASKELL__ < 914
182+
-- These constraints are REQUIRED for ghc < 9.14 but REDUNDANT for ghc >= 9.14
183+
-- See https://gitlab.haskell.org/ghc/ghc/-/issues/26381#note_637863
184+
, Show ParserError
185+
#endif
186+
) =>
163187
Show (Error uni fun ann)
164188

165189
instance Pretty SourcePos where

plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Core/Instance/Eq.hs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
-- editorconfig-checker-disable-file
22
{-# OPTIONS_GHC -fno-warn-orphans #-}
33

4+
{-# LANGUAGE CPP #-}
45
{-# LANGUAGE ConstraintKinds #-}
56
{-# LANGUAGE FlexibleInstances #-}
67
{-# LANGUAGE TypeOperators #-}
@@ -65,7 +66,13 @@ deriving stock instance
6566

6667
instance HashableTermConstraints uni fun ann => Hashable (Term DeBruijn uni fun ann)
6768

68-
deriving stock instance (GEq uni, Closed uni, uni `Everywhere` Eq, Eq fun, Eq ann,
69+
deriving stock instance (
70+
#if __GLASGOW_HASKELL__ < 914
71+
-- These constraints are REQUIRED for ghc < 9.14 but REDUNDANT for ghc >= 9.14
72+
-- See https://gitlab.haskell.org/ghc/ghc/-/issues/26381#note_637863
73+
GEq uni, Closed uni, Eq fun,
74+
#endif
75+
uni `Everywhere` Eq, Eq ann,
6976
Eq (Term name uni fun ann)
7077
) => Eq (Program name uni fun ann)
7178

plutus-tx/src/PlutusTx/BuiltinList.hs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
{-# LANGUAGE CPP #-}
2+
13
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}
24

35
{-# HLINT ignore "Redundant if" #-}
@@ -285,9 +287,13 @@ reverse xs = revAppend xs empty
285287

286288
-- | Plutus Tx version of 'Data.List.zip' for 'BuiltinList'.
287289
_zip
288-
:: forall a b
289-
. (MkNil a, MkNil b)
290-
=> BuiltinList a
290+
:: forall a b .
291+
#if __GLASGOW_HASKELL__ < 914
292+
-- These constraints are REQUIRED for ghc < 9.14 but REDUNDANT for ghc >= 9.14
293+
-- See https://gitlab.haskell.org/ghc/ghc/-/issues/26381#note_637863
294+
(MkNil a, MkNil b) =>
295+
#endif
296+
BuiltinList a
291297
-> BuiltinList b
292298
-> BuiltinList (BuiltinPair a b)
293299
_zip = zipWith (curry BI.BuiltinPair)

plutus-tx/src/PlutusTx/Builtins/HasOpaque.hs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,22 @@ instance MkNil BuiltinData
273273
instance MkNil BuiltinValue
274274
instance MkNil BuiltinBLS12_381_G1_Element
275275
instance MkNil BuiltinBLS12_381_G2_Element
276-
instance (MkNil a) => MkNil (BuiltinList a)
277-
instance (MkNil a, MkNil b) => MkNil (BuiltinPair a b)
276+
277+
instance
278+
#if __GLASGOW_HASKELL__ < 914
279+
-- This constraint is REQUIRED for ghc < 9.14 but REDUNDANT for ghc >= 9.14
280+
-- See https://gitlab.haskell.org/ghc/ghc/-/issues/26381#note_637863
281+
(MkNil a) =>
282+
#endif
283+
MkNil (BuiltinList a)
284+
285+
instance
286+
#if __GLASGOW_HASKELL__ < 914
287+
-- These constraints are REQUIRED for ghc < 9.14 but REDUNDANT for ghc >= 9.14
288+
-- See https://gitlab.haskell.org/ghc/ghc/-/issues/26381#note_637863
289+
(MkNil a, MkNil b) =>
290+
#endif
291+
MkNil (BuiltinPair a b)
278292

279293
instance (HasToOpaque a arep, MkNil arep) => HasToOpaque [a] (BuiltinList arep) where
280294
toOpaque = goList

plutus-tx/test/Show/Spec.hs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
1+
{-# LANGUAGE CPP #-}
12
{-# LANGUAGE GADTs #-}
23
{-# LANGUAGE OverloadedStrings #-}
34
{-# LANGUAGE TemplateHaskell #-}
45

6+
#if __GLASGOW_HASKELL__ >= 914
7+
-- Get a redundant constraint warning on `deriveShow`.
8+
-- The `Show` constraint is REQUIRED for ghc < 9.14 but REDUNDANT for ghc >= 9.14
9+
-- See https://gitlab.haskell.org/ghc/ghc/-/issues/26381#note_637863
10+
{-# OPTIONS_GHC -Wno-redundant-constraints #-}
11+
#endif
12+
513
module Show.Spec where
614

715
import PlutusTx.Bool

0 commit comments

Comments
 (0)