Last active
June 5, 2022 20:11
-
-
Save berberman/d550c7406b65244d523a61a781cc7136 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /usr/bin/env nix-shell | |
| #! nix-shell --pure -i "runghc -- -package --ghc-arg=ghc" -p "haskellPackages.ghcWithPackages (p: with p; [ ghc-exactprint pretty-simple ])" | |
| import GHC.Hs.Dump | |
| import Language.Haskell.GHC.ExactPrint.Parsers | |
| import GHC.Utils.Outputable | |
| import System.Environment | |
| import Text.Pretty.Simple | |
| main :: IO () | |
| main = do | |
| args <- getArgs | |
| case args of | |
| [file] -> do | |
| Right (anns, pm) <- parseModule file | |
| putStrLn . showSDocUnsafe $ showAstData NoBlankSrcSpan pm | |
| pPrint anns | |
| _ -> putStrLn "Expect one arg." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment