From 825f1ee5f9b0d6792ee5488e0bb2a30459d56982 Mon Sep 17 00:00:00 2001 From: Alan Zimmerman Date: Tue, 21 May 2024 18:53:50 +0100 Subject: [PATCH] Remove epUpdateAnchors. It is not needed, we always update the AST, the only question is if generate output while processing it, which is captured by the `epTokenPrint` and `epWhitespacePrint` options. --- src/Language/Haskell/GHC/ExactPrint/ExactPrint.hs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/Language/Haskell/GHC/ExactPrint/ExactPrint.hs b/src/Language/Haskell/GHC/ExactPrint/ExactPrint.hs index 3f216eda..5e79c1a0 100644 --- a/src/Language/Haskell/GHC/ExactPrint/ExactPrint.hs +++ b/src/Language/Haskell/GHC/ExactPrint/ExactPrint.hs @@ -26,7 +26,7 @@ module Language.Haskell.GHC.ExactPrint.ExactPrint , makeDeltaAst -- * Configuration - , EPOptions(epAstPrint, epTokenPrint, epWhitespacePrint, epUpdateAnchors) + , EPOptions(epAstPrint, epTokenPrint, epWhitespacePrint) , stringOptions , epOptions , deltaOptions @@ -133,32 +133,30 @@ data EPOptions m a = EPOptions epAstPrint :: forall ast . Data ast => GHC.Located ast -> a -> m a , epTokenPrint :: String -> m a , epWhitespacePrint :: String -> m a - , epUpdateAnchors :: Bool } -- | Helper to create a 'EPOptions' epOptions :: - (forall ast . Data ast => GHC.Located ast -> a -> m a) + (forall ast . Data ast + => GHC.Located ast -> a -> m a) -> (String -> m a) -> (String -> m a) - -> Bool -> EPOptions m a -epOptions astPrint tokenPrint wsPrint delta = EPOptions +epOptions astPrint tokenPrint wsPrint = EPOptions { epAstPrint = astPrint -- Not used , epWhitespacePrint = wsPrint , epTokenPrint = tokenPrint - , epUpdateAnchors = delta -- Not used } -- | Options which can be used to print as a normal String. stringOptions :: EPOptions Identity String -stringOptions = epOptions (\_ b -> return b) return return False +stringOptions = epOptions (\_ b -> return b) return return -- | Options which can be used to simply update the AST to be in delta -- form, without generating output deltaOptions :: EPOptions Identity () -deltaOptions = epOptions (\_ _ -> return ()) (\_ -> return ()) (\_ -> return ()) True +deltaOptions = epOptions (\_ _ -> return ()) (\_ -> return ()) (\_ -> return ()) data EPWriter a = EPWriter { output :: !a }