From 3faca807fe96f2cefa50023fe373d8bcf1430121 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Sat, 17 Feb 2024 09:22:49 +0100 Subject: Move to src/, working HLS in examples/ --- src/Main.hs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/Main.hs (limited to 'src/Main.hs') diff --git a/src/Main.hs b/src/Main.hs new file mode 100644 index 0000000..c9de0cc --- /dev/null +++ b/src/Main.hs @@ -0,0 +1,27 @@ +{-# LANGUAGE LambdaCase #-} +{-# LANGUAGE TupleSections #-} +module Main where + +import System.Environment (getArgs) +import System.Exit (die, exitFailure) + +import Parser + + +main :: IO () +main = do + (source, fname) <- getArgs >>= \case + [] -> (,"") <$> getContents + [fname] -> (,fname) <$> readFile fname + _ -> die "Usage: hs-visinter [filename.hs]" + + prog <- case parse fname source of + This errs -> do + mapM_ (putStrLn . printErrMsg) errs + exitFailure + These errs res -> do + mapM_ (putStrLn . printErrMsg) errs + return res + That res -> return res + + print prog -- cgit v1.2.3-70-g09d2