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

import GHC.Plugins
import GHC.Tc.Utils.Monad

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
      return tcg