uhc-light-1.1.8.0: src/Run.hs
module Main
where
import UHC.Light.Compiler.Base.API
import UHC.Light.Compiler.CoreRun.API
import UHC.Util.Pretty
import System.Console.GetOpt
import System.IO
import Control.Monad
import System.Environment
import qualified Data.ByteString.Char8 as B
{-# LINE 22 "src/ehc/Run.chs" #-}
-- | Top level main. TBD: hooks & customization
main :: IO ()
main = do
args <- getArgs
progName <- getProgName
-- putStrLn $ show args
case args of
[fname] -> {- withFile fname ReadMode $ \hInp -> -} do
-- putStrLn "Hi1"
-- inp <- B.hGetContents hInp
inp <- B.readFile fname
-- putStrLn $ show $ B.length inp
-- putStrLn "Hi2"
case parseModFromString $ B.unpack inp of
Left es -> forM_ es putStrLn
Right mod -> do
res <- runCoreRunIO defaultEHCOpts mod
case res of
Left e -> putStrLn $ show e
Right val -> putStrLn $ show $ pp val
_ ->
putStrLn $ "Usage: " ++ progName ++ " file.rcr"