module AutoInstrument.Internal.Plugin ( plugin ) where import qualified AutoInstrument.Internal.Config as Cfg import qualified AutoInstrument.Internal.GhcFacade as Ghc import qualified AutoInstrument.Internal.Plugin.Parser as Parser plugin :: Ghc.Plugin plugin :: Plugin plugin = Plugin Ghc.defaultPlugin { Ghc.pluginRecompile = pluginRecompile , Ghc.parsedResultAction = Parser.parsedResultAction } pluginRecompile :: [Ghc.CommandLineOption] -> IO Ghc.PluginRecompile pluginRecompile :: [CommandLineOption] -> IO PluginRecompile pluginRecompile [CommandLineOption] opts = do Maybe ConfigCache mCache <- [CommandLineOption] -> IO (Maybe ConfigCache) Cfg.getConfigCache [CommandLineOption] opts case Maybe ConfigCache mCache of Maybe ConfigCache Nothing -> PluginRecompile -> IO PluginRecompile forall a. a -> IO a forall (f :: * -> *) a. Applicative f => a -> f a pure PluginRecompile Ghc.NoForceRecompile Just ConfigCache cache -> PluginRecompile -> IO PluginRecompile forall a. a -> IO a forall (f :: * -> *) a. Applicative f => a -> f a pure (PluginRecompile -> IO PluginRecompile) -> (Fingerprint -> PluginRecompile) -> Fingerprint -> IO PluginRecompile forall b c a. (b -> c) -> (a -> b) -> a -> c . Fingerprint -> PluginRecompile Ghc.MaybeRecompile (Fingerprint -> IO PluginRecompile) -> Fingerprint -> IO PluginRecompile forall a b. (a -> b) -> a -> b $ ConfigCache -> Fingerprint Cfg.fingerprint ConfigCache cache