executable that typechecks files!!
This commit is contained in:
parent
c8fbd73ea4
commit
64ac16c9f9
1 changed files with 28 additions and 24 deletions
52
exe/Main.idr
52
exe/Main.idr
|
@ -1,17 +1,35 @@
|
||||||
module Main
|
module Main
|
||||||
|
|
||||||
import public Quox.Name
|
import Quox.Syntax
|
||||||
import public Quox.Syntax
|
import Quox.Parser
|
||||||
import public Quox.Equal
|
import Quox.Definition
|
||||||
import public Quox.Pretty
|
import Quox.Pretty
|
||||||
import public Quox.Typechecker
|
|
||||||
import public Quox.Syntax.Qty.Three
|
|
||||||
|
|
||||||
import Data.Nat
|
import System
|
||||||
import Data.Vect
|
import Data.IORef
|
||||||
import Data.List
|
import Data.SortedSet
|
||||||
import Control.ANSI
|
import Control.Eff
|
||||||
|
import Text.PrettyPrint.Prettyprinter.Render.Terminal
|
||||||
|
|
||||||
|
export
|
||||||
|
die : Doc HL -> IO a
|
||||||
|
die err = do putDoc $ termHL <$> err; exitFailure
|
||||||
|
|
||||||
|
export
|
||||||
|
main : IO ()
|
||||||
|
main = do
|
||||||
|
seen <- newIORef SortedSet.empty
|
||||||
|
defs <- newIORef SortedMap.empty
|
||||||
|
for_ (drop 1 !getArgs) $ \file => do
|
||||||
|
putStrLn "checking \{file}"
|
||||||
|
Right res <- fromParserIO ["."] seen defs $ loadProcessFile file
|
||||||
|
| Left err => die $ prettyError True True err
|
||||||
|
for_ res $ \(name, def) => do
|
||||||
|
putDoc $ map termHL $
|
||||||
|
sep [hl Free $ pretty0 True name, colonD,
|
||||||
|
prettyTerm True [<] [<] def.type]
|
||||||
|
|
||||||
|
-----------------------------------
|
||||||
|
|
||||||
private
|
private
|
||||||
text : PrettyOpts -> List String
|
text : PrettyOpts -> List String
|
||||||
|
@ -52,17 +70,3 @@ join1 opts l r =
|
||||||
export
|
export
|
||||||
banner : PrettyOpts -> String
|
banner : PrettyOpts -> String
|
||||||
banner opts = unlines $ zipWith (join1 opts) (qtuwu opts) (text opts)
|
banner opts = unlines $ zipWith (join1 opts) (qtuwu opts) (text opts)
|
||||||
|
|
||||||
export
|
|
||||||
tm : Term Three 1 2
|
|
||||||
tm =
|
|
||||||
(Pi_ One "a" (BVT 0) (E (F "F" :@@ [BVT 0, FT "w"]))
|
|
||||||
`DCloT` (K One ::: id))
|
|
||||||
`CloT` (F "y" ::: TYPE 1 :# TYPE 2 ::: id)
|
|
||||||
|
|
||||||
main : IO Unit
|
|
||||||
main = do
|
|
||||||
putStrLn $ banner defPrettyOpts
|
|
||||||
prettyIODef @{TermSubst True} tm
|
|
||||||
prettyIODef @{TermSubst True} $ fst $ pushSubsts tm
|
|
||||||
prettyIODef tm
|
|
||||||
|
|
Loading…
Reference in a new issue