summaryrefslogtreecommitdiff
path: root/testsuite/tests/plugins/simple-plugin/Simple/TrustworthyPlugin.hs
blob: 802a05803a324fd55666fc3c98c71a01bb48bf44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
module Simple.TrustworthyPlugin (plugin) where

import GHC.Plugins
import GHC.Tc.Utils.Monad
import System.IO

plugin :: Plugin
plugin = defaultPlugin
  { renamedResultAction = keepRenamedSource
  , typeCheckResultAction = printHaskellSafeMode
  }
  where
    printHaskellSafeMode _ ms tcg = liftIO $ do
      let dflags = ms_hspp_opts ms
      safe <- finalSafeMode dflags tcg
      print $ gopt Opt_PluginTrustworthy dflags
      putStrLn $ showPpr dflags safe
      -- TODO: Remove #20791
      hFlush stdout
      return tcg