-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
9.6 support #54
9.6 support #54
Conversation
Hi @wz1000! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
I think you meant that this is based on alanz/ghc-exactprint#124 I had to patch a bit in order to get this to build, using the following: diff --git a/Retrie/Elaborate.hs b/Retrie/Elaborate.hs
index 1c88441..8be459f 100644
--- a/Retrie/Elaborate.hs
+++ b/Retrie/Elaborate.hs
@@ -103,7 +103,7 @@ allMatches _ [] = return []
allMatches ctxt matchResults = do
results <-
forM matchResults $ \(sub, RewriterResult{..}) -> do
- result <- lift $ liftIO $ rrTransformer ctxt $ MatchResult sub rrTemplate
+ result <- TransformT $ lift $ liftIO $ rrTransformer ctxt $ MatchResult sub rrTemplate
return (rrQuantifiers, result)
return
[ project <$> result
diff --git a/Retrie/Rewrites/Function.hs b/Retrie/Rewrites/Function.hs
index 3944584..9f24977 100644
--- a/Retrie/Rewrites/Function.hs
+++ b/Retrie/Rewrites/Function.hs
@@ -53,7 +53,7 @@ dfnsToRewrites libdir specs am = fmap astA $ transformA am $ \ (L _ m) -> do
getImports
:: LibDir -> Direction -> Maybe (LocatedA ModuleName) -> TransformT IO AnnotatedImports
getImports libdir RightToLeft (Just (L _ mn)) = -- See Note [fold only]
- lift $ liftIO $ parseImports libdir ["import " ++ moduleNameString mn]
+ TransformT $ lift $ liftIO $ parseImports libdir ["import " ++ moduleNameString mn]
getImports _ _ _ = return mempty
matchToRewrites
diff --git a/Retrie/Types.hs b/Retrie/Types.hs
index 0f082b0..4bd7fb6 100644
--- a/Retrie/Types.hs
+++ b/Retrie/Types.hs
@@ -329,7 +329,7 @@ firstMatch _ [] = return NoMatch
firstMatch ctxt ((sub, RewriterResult{..}):matchResults) = do
-- 'firstMatch' is lazy in 'rrTransformer', only running it enough
-- times to get the first valid MatchResult.
- matchResult <- lift $ liftIO $ rrTransformer ctxt (MatchResult sub rrTemplate)
+ matchResult <- TransformT $ lift $ liftIO $ rrTransformer ctxt (MatchResult sub rrTemplate)
case matchResult of
MatchResult sub' _
-- Check that all quantifiers from the original rewrite have mappings This is because of the following change https://github.com/alanz/ghc-exactprint/pull/124/files#r1140532016 |
This is based on the 9.6 branch of ghc exactprint: alanz/ghc-exactprint#123