perga/app/Main.hs

20 lines
423 B
Haskell
Raw Normal View History

2024-10-05 13:31:09 -07:00
module Main where
2024-11-11 17:57:14 -08:00
import Check
2024-10-06 14:02:35 -07:00
import Expr
2024-10-05 16:04:13 -07:00
import Parser
2024-11-14 22:02:04 -08:00
import qualified Data.Text.IO as T
2024-10-05 16:04:13 -07:00
import System.IO
2024-11-11 14:34:55 -08:00
2024-10-05 13:31:09 -07:00
main :: IO ()
2024-10-05 16:04:13 -07:00
main = do
2024-11-14 22:02:04 -08:00
_ <- T.putStr "> "
2024-10-06 14:02:35 -07:00
_ <- hFlush stdout
2024-11-14 22:02:04 -08:00
input <- T.getLine
2024-10-06 14:02:35 -07:00
case pAll input of
2024-11-14 22:02:04 -08:00
Left err -> T.putStrLn err
Right expr -> case findType [] expr of
2024-11-14 22:02:04 -08:00
Right ty -> T.putStrLn $ pretty expr <> " : " <> pretty ty
2024-11-11 17:57:14 -08:00
Left err -> print err
2024-11-11 13:37:44 -08:00
main