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 559712d
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions cli/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,25 @@ 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" ++
"\n" ++
show types ++
"////////////////////////////////////////////////////////////////////////////////\n" ++
"// environment //\n" ++
"////////////////////////////////////////////////////////////////////////////////\n" ++
"\n" ++
show env
Left err -> err

0 comments on commit 559712d

Please sign in to comment.