diff options
author | Tom Smeding <tom@tomsmeding.com> | 2023-12-23 23:12:03 +0100 |
---|---|---|
committer | Tom Smeding <tom@tomsmeding.com> | 2023-12-23 23:12:07 +0100 |
commit | ae603f2423e967c55dfd31b0dec26d19584aa322 (patch) | |
tree | d40ba193a58001453825c7f4dcd164767e327577 /app/Main.hs | |
parent | 37acb2efba1cd159bda5d163192e2aba70c4e26b (diff) |
Can typecheck universe-polymorphic id
Diffstat (limited to 'app/Main.hs')
-rw-r--r-- | app/Main.hs | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/app/Main.hs b/app/Main.hs index 65ae4a0..f8b586a 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -1,4 +1,28 @@ module Main where +import qualified Data.Map.Strict as Map +import System.Exit (die) + +import AST +import Parser +import TypeCheck + + main :: IO () -main = putStrLn "Hello, Haskell!" +main = do + source <- getContents + + uprog <- case parseProgram "<stdin>" source of + Left err -> die (show err) + Right term -> return term + + let env0 = Map.fromList + [("Level", Nothing :| TLevelUniv) + ,("lzero", Nothing :| TLevel) + ,("lsuc", Nothing :| TPi "x" TLevel TLevel)] + + env <- case checkProgram env0 uprog of + Left err -> die err + Right env -> return env + + print env |