blob: a6cee0fd7f7e3882788995a709c6c2789c814354 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
module Main where
import GHC.Driver.Session
import GHC
import Control.Monad.IO.Class (liftIO)
import System.Environment
import GHC.Parser.Header
import GHC.Utils.Outputable
import GHC.Data.StringBuffer
main :: IO ()
main = do
[libdir] <- getArgs
runGhc (Just libdir) $ do
dflags <- getSessionDynFlags
let dflags' = dflags `gopt_set` Opt_KeepRawTokenStream
`gopt_set` Opt_Haddock
filename = "T10942_A.hs"
setSessionDynFlags dflags'
stringBuffer <- liftIO $ hGetStringBuffer filename
liftIO $ print (map unLoc (getOptions dflags' stringBuffer filename))
|