Skip to content

Commit 06a7991

Browse files
committed
Fix warnings from upgrading GHC to 9.2.x.
Fix warnings, namely -Wstar-is-type. Many -Wincomplete-uni-patterns warnings are not yet fixed.
1 parent 1ab780a commit 06a7991

21 files changed

+92
-100
lines changed

makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ ifneq (,$(DEX_CI))
118118
STACK_FLAGS := $(STACK_FLAGS) --flag dex:debug
119119
endif
120120

121-
possible-clang-locations := clang++-9 clang++-10 clang++-11 clang++-12 clang++-15 clang++
121+
possible-clang-locations := clang++-15 clang++
122122

123123
CLANG := clang++
124124

@@ -133,11 +133,11 @@ CLANG := $(shell for clangversion in $(possible-clang-locations) ; do \
133133
if [[ $$(command -v "$$clangversion" 2>/dev/null) ]]; \
134134
then echo "$$clangversion" ; break ; fi ; done)
135135
ifeq (,$(CLANG))
136-
$(error "Please install clang++-12")
136+
$(error "Please install clang++-15")
137137
endif
138-
clang-version-compatible := $(shell $(CLANG) -dumpversion | awk '{ print(gsub(/^((9\.)|(10\.)|(11\.)|(12\.)|(15\.)).*$$/, "")) }')
138+
clang-version-compatible := $(shell $(CLANG) -dumpversion | awk '{ print(gsub(/^((15\.)).*$$/, "")) }')
139139
ifneq (1,$(clang-version-compatible))
140-
$(error "Please install clang++-12")
140+
$(error "Please install clang++-15")
141141
endif
142142
endif
143143

src/lib/Builder.hs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import Control.Monad
1414
import Control.Monad.Reader
1515
import Control.Monad.Writer.Strict hiding (Alt)
1616
import Control.Monad.State.Strict (MonadState (..), StateT (..), runStateT)
17+
import qualified Data.Kind as K
1718
import qualified Data.Map.Strict as M
1819
import Data.Maybe (isJust)
1920
import Data.Graph (graphFromEdges, topSort)
@@ -136,7 +137,7 @@ liftTopBuilderAndEmit
136137
liftTopBuilderAndEmit cont = do
137138
liftTopBuilderHoisted cont >>= emitHoistedEnv
138139

139-
newtype DoubleBuilderT (r::IR) (topEmissions::B) (m::MonadKind) (n::S) (a:: *) =
140+
newtype DoubleBuilderT (r::IR) (topEmissions::B) (m::MonadKind) (n::S) (a::K.Type) =
140141
DoubleBuilderT { runDoubleBuilderT' :: DoubleInplaceT Env topEmissions (BuilderEmissions r) m n a }
141142
deriving ( Functor, Applicative, Monad, MonadFail, Fallible
142143
, CtxReader, MonadIO, Catchable, MonadReader r')
@@ -343,7 +344,7 @@ lookupPtrName v = lookupEnv v >>= \case
343344
getCache :: EnvReader m => m n (Cache n)
344345
getCache = withEnv $ envCache . topEnv
345346

346-
newtype TopBuilderT (m::MonadKind) (n::S) (a:: *) =
347+
newtype TopBuilderT (m::MonadKind) (n::S) (a::K.Type) =
347348
TopBuilderT { runTopBuilderT' :: InplaceT Env TopEnvFrag m n a }
348349
deriving ( Functor, Applicative, Monad, MonadFail, Fallible
349350
, CtxReader, ScopeReader, MonadTrans1, MonadReader r
@@ -418,7 +419,7 @@ instance (SinkableE e, HoistableState e, TopBuilder m) => TopBuilder (StateT1 e
418419

419420
type BuilderEmissions r = RNest (Decl r)
420421

421-
newtype BuilderT (r::IR) (m::MonadKind) (n::S) (a:: *) =
422+
newtype BuilderT (r::IR) (m::MonadKind) (n::S) (a::K.Type) =
422423
BuilderT { runBuilderT' :: InplaceT Env (BuilderEmissions r) m n a }
423424
deriving ( Functor, Applicative, Monad, MonadTrans1, MonadFail, Fallible
424425
, Catchable, CtxReader, ScopeReader, Alternative, Searcher

src/lib/CheapReduction.hs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ import Control.Monad.State.Strict
2323
import Data.Foldable (toList)
2424
import Data.Functor.Identity
2525
import Data.Functor ((<&>))
26-
import qualified Data.List.NonEmpty as NE
26+
import qualified Data.Kind as K
27+
import qualified Data.List.NonEmpty as NE
2728
import qualified Data.Map.Strict as M
2829
import GHC.Exts (inline)
2930

@@ -80,7 +81,7 @@ cheapNormalize a = cheapReduce a >>= \case
8081

8182
-- === internal ===
8283

83-
newtype CheapReducerM (r::IR) (i :: S) (o :: S) (a :: *) =
84+
newtype CheapReducerM (r::IR) (i :: S) (o :: S) (a :: K.Type) =
8485
CheapReducerM
8586
(SubstReaderT AtomSubstVal
8687
(MaybeT1

src/lib/CheckType.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import Control.Monad.Reader
1717
import Data.Maybe (isJust)
1818
import Data.Foldable (toList)
1919
import Data.Functor
20+
import qualified Data.Kind as K
2021
import qualified Data.List.NonEmpty as NE
2122
import qualified Data.Map.Strict as M
2223

@@ -61,7 +62,7 @@ class ( Monad2 m, Fallible2 m, SubstReader Name m
6162
, EnvReader2 m, EnvExtender2 m)
6263
=> Typer (m::MonadKind2)
6364

64-
newtype TyperT (m::MonadKind) (i::S) (o::S) (a :: *) =
65+
newtype TyperT (m::MonadKind) (i::S) (o::S) (a::K.Type) =
6566
TyperT { runTyperT' :: SubstReaderT Name (EnvReaderT m) i o a }
6667
deriving ( Functor, Applicative, Monad
6768
, SubstReader Name

src/lib/Core.hs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ import Control.Monad.Reader
3030
import Control.Monad.Writer.Strict hiding (Alt)
3131
import Control.Monad.State
3232
import qualified Control.Monad.State.Strict as SS
33-
import qualified Data.Map.Strict as M
33+
import qualified Data.Map.Strict as M
34+
import qualified Data.Kind as K
3435

3536
import Name
3637
import Err
@@ -76,7 +77,7 @@ type EnvExtender2 (m::MonadKind2) = forall (n::S). EnvExtender (m n)
7677

7778
-- === EnvReader monad ===
7879

79-
newtype EnvReaderT (m::MonadKind) (n::S) (a:: *) =
80+
newtype EnvReaderT (m::MonadKind) (n::S) (a::K.Type) =
8081
EnvReaderT {runEnvReaderT' :: ReaderT (DistinctEvidence n, Env n) m a }
8182
deriving ( Functor, Applicative, Monad, MonadFail
8283
, MonadWriter w, Fallible, Searcher, Alternative)

src/lib/Err.hs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,14 +158,12 @@ instance Functor Except where
158158
{-# INLINE fmap #-}
159159

160160
instance Applicative Except where
161-
pure = return
161+
pure = Success
162162
{-# INLINE pure #-}
163163
liftA2 = liftM2
164164
{-# INLINE liftA2 #-}
165165

166166
instance Monad Except where
167-
return = Success
168-
{-# INLINE return #-}
169167
Failure errs >>= _ = Failure errs
170168
Success x >>= f = f x
171169
{-# INLINE (>>=) #-}
@@ -211,8 +209,6 @@ instance Applicative HardFailM where
211209
instance Monad HardFailM where
212210
(HardFailM (Identity x)) >>= k = k x
213211
{-# INLINE (>>=) #-}
214-
return = HardFailM . Identity
215-
{-# INLINE return #-}
216212

217213
runHardFail :: HardFailM a -> a
218214
runHardFail m = runIdentity $ runHardFail' m

src/lib/Export.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ module Export (
1414

1515
import Control.Category ((>>>))
1616
import Data.List (intercalate)
17+
import qualified Data.Kind as K
1718
import Foreign.Storable
1819
import Foreign.C.String
1920
import Foreign.Ptr
@@ -87,7 +88,7 @@ instance SinkableV (Rename r)
8788
instance FromName (Rename r) where
8889
fromName = JustRefer
8990

90-
newtype ExportSigM (r::IR) (i::S) (o::S) (a:: *) = ExportSigM {
91+
newtype ExportSigM (r::IR) (i::S) (o::S) (a::K.Type) = ExportSigM {
9192
runExportSigM :: SubstReaderT (Rename r) (EnvReaderT FallibleM) i o a }
9293
deriving ( Functor, Applicative, Monad, ScopeReader, EnvExtender, Fallible
9394
, EnvReader, SubstReader (Rename r), MonadFail)

src/lib/Imp.hs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import Data.Functor
2222
import Data.Foldable (toList)
2323
import Data.Maybe (fromJust)
2424
import Data.Text.Prettyprint.Doc
25+
import qualified Data.Kind as K
2526
import Control.Category
2627
import Control.Monad.Identity
2728
import Control.Monad.Reader
@@ -171,12 +172,12 @@ instance ExtOutFrag ImpBuilderEmissions ImpDeclEmission where
171172
extendOutFrag ems (ImpDeclEmission d) = RNest ems d
172173
{-# INLINE extendOutFrag #-}
173174

174-
newtype ImpM (n::S) (a:: *) =
175+
newtype ImpM (n::S) (a::K.Type) =
175176
ImpM { runImpM' :: WriterT1 (ListE IExpr)
176177
(InplaceT Env ImpBuilderEmissions HardFailM) n a }
177178
deriving ( Functor, Applicative, Monad, ScopeReader, Fallible, MonadFail)
178179

179-
type SubstImpM = SubstReaderT AtomSubstVal ImpM :: S -> S -> * -> *
180+
type SubstImpM = SubstReaderT AtomSubstVal ImpM :: S -> S -> K.Type -> K.Type
180181

181182
instance ExtOutMap Env ImpBuilderEmissions where
182183
extendOutMap bindings emissions =

src/lib/Inference.hs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import Data.List (sortOn)
2626
import Data.Maybe (fromJust, fromMaybe, catMaybes)
2727
import Data.Text.Prettyprint.Doc (Pretty (..), (<+>), vcat)
2828
import Data.Word
29+
import qualified Data.Kind as K
2930
import qualified Data.HashMap.Strict as HM
3031
import qualified Data.List.NonEmpty as NE
3132
import qualified Data.Map.Strict as M
@@ -396,7 +397,7 @@ extendOutMapWithConstraints env us ss (Constraints allCs) = case tryUnsnoc allCs
396397
let ss''' = SolverSubst $ ss'' <> s
397398
(env'', us'', ss''')
398399

399-
newtype InfererM (i::S) (o::S) (a:: *) = InfererM
400+
newtype InfererM (i::S) (o::S) (a::K.Type) = InfererM
400401
{ runInfererM' :: SubstReaderT Name (InplaceT InfOutMap InfOutFrag FallibleM) i o a }
401402
deriving (Functor, Applicative, Monad, MonadFail,
402403
ScopeReader, Fallible, Catchable, CtxReader, SubstReader Name)
@@ -2346,7 +2347,7 @@ instance ExtOutMap InfOutMap SolverOutFrag where
23462347
extendOutMap infOutMap outFrag =
23472348
extendOutMap infOutMap $ liftSolverOutFrag outFrag
23482349

2349-
newtype SolverM (n::S) (a:: *) =
2350+
newtype SolverM (n::S) (a::K.Type) =
23502351
SolverM { runSolverM' :: InplaceT SolverOutMap SolverOutFrag SearcherM n a }
23512352
deriving (Functor, Applicative, Monad, MonadFail, Alternative, Searcher,
23522353
ScopeReader, Fallible, CtxReader)
@@ -2899,7 +2900,7 @@ class (Alternative1 m, Searcher1 m, EnvReader m, EnvExtender m)
28992900
getGivens :: m n (Givens n)
29002901
withGivens :: Givens n -> m n a -> m n a
29012902

2902-
newtype SyntherM (n::S) (a:: *) = SyntherM
2903+
newtype SyntherM (n::S) (a::K.Type) = SyntherM
29032904
{ runSyntherM' :: OutReaderT Givens (EnvReaderT []) n a }
29042905
deriving ( Functor, Applicative, Monad, EnvReader, EnvExtender
29052906
, ScopeReader, MonadFail

src/lib/Inline.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
module Inline (inlineBindings) where
88

9+
import qualified Data.Kind as K
910
import Data.Functor
1011
import Data.List.NonEmpty qualified as NE
1112

@@ -54,7 +55,7 @@ instance SinkableE (InlineExpr r) where
5455

5556
type InlineSubstVal = SubstVal InlineExpr
5657

57-
newtype InlineM (i::S) (o::S) (a:: *) = InlineM
58+
newtype InlineM (i::S) (o::S) (a::K.Type) = InlineM
5859
{ runInlineM :: SubstReaderT InlineSubstVal (BuilderM SimpIR) i o a }
5960
deriving ( Functor, Applicative, Monad, MonadFail, Fallible, ScopeReader
6061
, EnvExtender, EnvReader, SubstReader InlineSubstVal, (Builder SimpIR)

0 commit comments

Comments
 (0)