Skip to content

Commit 5d91e9c

Browse files
authored
Merge pull request #185 from well-typed/ghc-tcplugin-api-0.17
Use ghc-tcplugin-api-0.17.1.0
2 parents 10f93d1 + 2940482 commit 5d91e9c

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

large-anon/large-anon.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ library
8181
, containers >= 0.6.2 && < 0.9
8282
, deepseq >= 1.4.4 && < 1.6
8383
, ghc >= 8.10 && < 9.13
84-
, ghc-tcplugin-api >= 0.16.2.0 && < 0.17
84+
, ghc-tcplugin-api >= 0.17.1.0 && < 0.18
8585
, hashable >= 1.3 && < 1.6
8686
, mtl >= 2.2.1 && < 2.4
8787
, optics-core >= 0.3 && < 0.5

large-anon/src/Data/Record/Anon/Internal/Plugin/TC/Constraints/KnownHash.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ parseKnownHash ::
4848
-> Ct
4949
-> ParseResult Void (GenLocated CtLoc CKnownHash)
5050
parseKnownHash _ ResolvedNames{..} =
51-
parseConstraint isRelevant $ \(ty, label) -> do
51+
parseConstraint isRelevant (text "isRelevant") $ \(ty, label) -> do
5252
return $ CKnownHash {
5353
knownHashLabel = label
5454
, knownHashType = ty

large-anon/src/Data/Record/Anon/Internal/Plugin/TC/Parsing.hs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,11 @@ withOrig f x = fmap (x, ) $ f x
8181
parseConstraint ::
8282
HasCallStack
8383
=> (Class -> [Type] -> Maybe a) -- ^ Do we want to try and match against this?
84+
-> SDoc -- ^ Description of above predicate
8485
-> (a -> Maybe b) -- ^ Parser for the class arguments
8586
-> Ct -- ^ Constraint to parse
8687
-> ParseResult e (GenLocated CtLoc b)
87-
parseConstraint p f ct = fmap (L $ ctLoc ct) $
88+
parseConstraint p doc f ct = fmap (L $ ctLoc ct) $
8889
-- TODO: classify up to equalities..?
8990
case classifyPredType (ctPred ct) of
9091
ClassPred cls args | Just a <- p cls args ->
@@ -97,6 +98,8 @@ parseConstraint p f ct = fmap (L $ ctLoc ct) $
9798
, showSDocUnsafe (ppr cls)
9899
, " constraint with arguments:\n"
99100
, unlines (map (showSDocUnsafe . ppr) args)
101+
, "\nWhen parsing " ++ showSDocUnsafe (ppr ct)
102+
, "\nlooking for " ++ showSDocUnsafe doc
100103
, "\nat\n"
101104
, prettyCallStack callStack
102105
]
@@ -110,7 +113,7 @@ parseConstraint' ::
110113
-> ([Type] -> Maybe a) -- ^ Parser for the class arguments
111114
-> Ct -- ^ Constraint to parse
112115
-> ParseResult e (GenLocated CtLoc a)
113-
parseConstraint' cls = parseConstraint p
116+
parseConstraint' cls = parseConstraint p (ppr cls)
114117
where
115118
p :: Class -> [Type] -> Maybe [Type]
116119
p cls' args = if cls == cls' then Just args else Nothing
@@ -152,4 +155,11 @@ parseInjTyConApp tcs tyCon t = do
152155
-- When this is the case, however, by injectivity of 'tyCon' we know that
153156
-- @args1 ~ args1'@, so we can just return /any/ of the matches; we will
154157
-- return the first.
155-
lookup tyCon (toList splits)
158+
--
159+
-- 2025-08-26: we ignore constraints here.
160+
-- Prior using ghc-tcplugin-api-0.17 we ignored them by necessity and plugin worked.
161+
-- There is a concern that the plugin should record (equality) constraints
162+
-- used for reasoning in evidences it constructs,
163+
-- but AFAIK, GHC simply has no direct mechanism to do that
164+
-- (see the hoops GHC itself jumps though to make `unsafeCoerce` behave well).
165+
lookup tyCon [ (x,y) | (x,y,_) <- toList splits]

typelet/typelet.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ library
4444
, base >= 4.14 && < 4.22
4545
, containers >= 0.6 && < 0.9
4646
, ghc >= 8.10 && < 9.13
47-
, ghc-tcplugin-api >= 0.16.1 && < 0.17
47+
, ghc-tcplugin-api >= 0.16.1 && < 0.18
4848
hs-source-dirs:
4949
src
5050
default-language:

0 commit comments

Comments
 (0)