mirror of
https://github.com/google/ormolu.git
synced 2024-12-18 04:51:29 +03:00
28 lines
719 B
Haskell
28 lines
719 B
Haskell
module Main (main) where
|
|
|
|
import Control.Monad
|
|
import Ormolu.Parser
|
|
import System.Environment (getArgs)
|
|
import qualified Outputable as GHC
|
|
|
|
main :: IO ()
|
|
main = do
|
|
(path:_) <- getArgs
|
|
input <- readFile path
|
|
(ws, r) <- parseModule [] path input
|
|
unless (null ws) $
|
|
putStrLn "dynamic option warnings:"
|
|
-- TODO print ws
|
|
case r of
|
|
Left (srcSpan, err) -> do
|
|
putStrLn (showOutputable srcSpan)
|
|
putStrLn err
|
|
Right (anns, parsedModule) -> do
|
|
putStrLn "\nannotations:\n"
|
|
putStrLn (showOutputable anns)
|
|
putStrLn "\nparsed module:\n"
|
|
putStrLn (showOutputable parsedModule)
|
|
|
|
showOutputable :: GHC.Outputable o => o -> String
|
|
showOutputable = GHC.showSDocUnsafe . GHC.ppr
|