From e72788ad0bfada1b3ced874c8300edf02ef84d6f Mon Sep 17 00:00:00 2001
From: David Binder <david.binder@uni-tuebingen.de>
Date: Thu, 7 Sep 2023 15:19:31 +0200
Subject: [PATCH] Remove init_flags and final_flags from plugin type

Removes an extension point to the Plugin type which wasn't used.
---
 src/HpcCombine.hs | 12 +++---------
 src/HpcDraft.hs   |  4 +---
 src/HpcFlags.hs   |  4 +---
 src/HpcMain.hs    | 10 +++-------
 src/HpcMarkup.hs  |  4 +---
 src/HpcOverlay.hs |  4 +---
 src/HpcReport.hs  |  4 +---
 src/HpcShowTix.hs |  4 +---
 8 files changed, 12 insertions(+), 34 deletions(-)

diff --git a/src/HpcCombine.hs b/src/HpcCombine.hs
index cebb21e..7dc568d 100644
--- a/src/HpcCombine.hs
+++ b/src/HpcCombine.hs
@@ -29,9 +29,7 @@ sumPlugin =
       usage = "[OPTION] .. <TIX_FILE> [<TIX_FILE> [<TIX_FILE> ..]]",
       options = sumOptions,
       summary = "Sum multiple .tix files in a single .tix file",
-      implementation = sumMain,
-      init_flags = defaultFlags,
-      final_flags = defaultFinalFlags
+      implementation = sumMain
     }
 
 combineOptions :: FlagOptSeq
@@ -51,9 +49,7 @@ combinePlugin =
       usage = "[OPTION] .. <TIX_FILE> <TIX_FILE>",
       options = combineOptions,
       summary = "Combine two .tix files in a single .tix file",
-      implementation = combineMain,
-      init_flags = defaultFlags,
-      final_flags = defaultFinalFlags
+      implementation = combineMain
     }
 
 mapOptions :: FlagOptSeq
@@ -73,9 +69,7 @@ mapPlugin =
       usage = "[OPTION] .. <TIX_FILE> ",
       options = mapOptions,
       summary = "Map a function over a single .tix file",
-      implementation = mapMain,
-      init_flags = defaultFlags,
-      final_flags = defaultFinalFlags
+      implementation = mapMain
     }
 
 ------------------------------------------------------------------------------
diff --git a/src/HpcDraft.hs b/src/HpcDraft.hs
index 7ee6553..ea4acc1 100644
--- a/src/HpcDraft.hs
+++ b/src/HpcDraft.hs
@@ -28,9 +28,7 @@ draftPlugin =
       usage = "[OPTION] .. <TIX_FILE>",
       options = draftOptions,
       summary = "Generate draft overlay that provides 100% coverage",
-      implementation = draftMain,
-      init_flags = defaultFlags,
-      final_flags = defaultFinalFlags
+      implementation = draftMain
     }
 
 ------------------------------------------------------------------------------
diff --git a/src/HpcFlags.hs b/src/HpcFlags.hs
index e0a7599..c795267 100644
--- a/src/HpcFlags.hs
+++ b/src/HpcFlags.hs
@@ -262,9 +262,7 @@ data Plugin = Plugin
     usage :: String,
     options :: FlagOptSeq,
     summary :: String,
-    implementation :: Flags -> [String] -> IO (),
-    init_flags :: Flags,
-    final_flags :: Flags -> Flags
+    implementation :: Flags -> [String] -> IO ()
   }
 
 ------------------------------------------------------------------------------
diff --git a/src/HpcMain.hs b/src/HpcMain.hs
index 9fb83ce..74c98ce 100644
--- a/src/HpcMain.hs
+++ b/src/HpcMain.hs
@@ -156,7 +156,7 @@ dispatchOnPlugin plugin args =
       commandUsage plugin
       exitFailure
     (o, ns, _) -> do
-      let flags = final_flags plugin (foldr ($) (init_flags plugin) o)
+      let flags = defaultFinalFlags (foldr ($) defaultFlags o)
       implementation plugin flags ns
 
 hooks :: [Plugin]
@@ -183,9 +183,7 @@ helpPlugin =
       usage = "[<HPC_COMMAND>]",
       summary = "Display help for hpc or a single command",
       options = id,
-      implementation = helpMain,
-      init_flags = defaultFlags,
-      final_flags = defaultFinalFlags
+      implementation = helpMain
     }
 
 helpMain :: Flags -> [String] -> IO ()
@@ -208,9 +206,7 @@ versionPlugin =
       usage = "",
       summary = "Display version for hpc",
       options = id,
-      implementation = versionMain,
-      init_flags = defaultFlags,
-      final_flags = defaultFinalFlags
+      implementation = versionMain
     }
 
 versionMain :: Flags -> [String] -> IO ()
diff --git a/src/HpcMarkup.hs b/src/HpcMarkup.hs
index 849a3e1..1c787db 100644
--- a/src/HpcMarkup.hs
+++ b/src/HpcMarkup.hs
@@ -39,9 +39,7 @@ markupPlugin =
       usage = "[OPTION] .. <TIX_FILE> [<MODULE> [<MODULE> ..]]",
       options = markupOptions,
       summary = "Markup Haskell source with program coverage",
-      implementation = markupMain,
-      init_flags = defaultFlags,
-      final_flags = defaultFinalFlags
+      implementation = markupMain
     }
 
 ------------------------------------------------------------------------------
diff --git a/src/HpcOverlay.hs b/src/HpcOverlay.hs
index db9046b..831edb8 100644
--- a/src/HpcOverlay.hs
+++ b/src/HpcOverlay.hs
@@ -26,9 +26,7 @@ overlayPlugin =
       usage = "[OPTION] .. <OVERLAY_FILE> [<OVERLAY_FILE> [...]]",
       options = overlayOptions,
       summary = "Generate a .tix file from an overlay file",
-      implementation = overlayMain,
-      init_flags = defaultFlags,
-      final_flags = defaultFinalFlags
+      implementation = overlayMain
     }
 
 overlayMain :: Flags -> [String] -> IO ()
diff --git a/src/HpcReport.hs b/src/HpcReport.hs
index 14a36b4..ca01da4 100644
--- a/src/HpcReport.hs
+++ b/src/HpcReport.hs
@@ -308,9 +308,7 @@ reportPlugin =
       usage = "[OPTION] .. <TIX_FILE> [<MODULE> [<MODULE> ..]]",
       options = reportFlags,
       summary = "Output textual report about program coverage",
-      implementation = reportMain,
-      init_flags = defaultFlags,
-      final_flags = defaultFinalFlags
+      implementation = reportMain
     }
 
 reportMain :: Flags -> [String] -> IO ()
diff --git a/src/HpcShowTix.hs b/src/HpcShowTix.hs
index 9b91988..bb34621 100644
--- a/src/HpcShowTix.hs
+++ b/src/HpcShowTix.hs
@@ -24,9 +24,7 @@ showtixPlugin =
       usage = "[OPTION] .. <TIX_FILE> [<MODULE> [<MODULE> ..]]",
       options = showtixOptions,
       summary = "Show .tix file in readable, verbose format",
-      implementation = showtixMain,
-      init_flags = defaultFlags,
-      final_flags = defaultFinalFlags
+      implementation = showtixMain
     }
 
 showtixMain :: Flags -> [String] -> IO ()
-- 
GitLab