Skip to content

Commit

Permalink
Prettify top-level output. #71
Browse files Browse the repository at this point in the history
  • Loading branch information
epost committed Aug 9, 2019
1 parent e6ae75b commit 7b60331
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions cli/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,24 @@ module Main where
import Language.CQL
import System.Environment


main :: IO ()
main = do args <- getArgs
w <- mapM readFile args
_ <- mapM (putStrLn . f' . runProg) w
return ()
where f' (Left x) = x
f' (Right (_,t,c)) = show t ++ "\n\n-------------------\n\n" ++ show c
main = do
args <- getArgs
src <- mapM readFile args
_ <- mapM (putStrLn . showResult . runProg) src
return ()
where
showResult r = case r of
Right (_, types, env) ->
"////////////////////////////////////////////////////////////////////////////////\n" ++
"// types //\n" ++
"////////////////////////////////////////////////////////////////////////////////\n" ++
"\n" ++
show types ++
"////////////////////////////////////////////////////////////////////////////////\n" ++
"// environment //\n" ++
"////////////////////////////////////////////////////////////////////////////////\n" ++
"\n" ++
show env
Left err -> err

0 comments on commit 7b60331

Please sign in to comment.