quox/exe/Main.idr
2023-03-15 15:42:28 +01:00

68 lines
1.5 KiB
Idris
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

module Main
import public Quox.Name
import public Quox.Syntax
import public Quox.Equal
import public Quox.Pretty
import public Quox.Typechecker
import public Quox.Syntax.Qty.Three
import Data.Nat
import Data.Vect
import Data.List
import Control.ANSI
private
text : PrettyOpts -> List String
text _ =
["",
#" ___ ___ _____ __ __"#,
#"/ _ `/ // / _ \\ \ /"#,
#"\_, /\_,_/\___/_\_\"#,
#" /_/"#,
""]
private
qtuwu : PrettyOpts -> List String
qtuwu opts =
if opts.unicode then
[#" ___,-´⎠ "#,
#"(·`──´ ◡ -´⎠"#,
#" \/\/──´⎞/`──´ "#,
#" ⎜⎟───,-₎ ⎞ "#,
#" ⎝⎠ (‾‾) ⎟ "#,
#" (‾‾‾) ⎟ "#]
else
[#" ___,-´/ "#,
#"(.`--´ u -´/"#,
#" \/\/--´|/`--´ "#,
#" ||---,-, \ "#,
#" `´ (--) | "#,
#" (---) | "#]
private
join1 : PrettyOpts -> String -> String -> String
join1 opts l r =
if opts.color then
" " <+> show (colored Green l) <+> " " <+> show (colored Magenta r)
else
" " <+> l <+> " " <+> r
export
banner : PrettyOpts -> String
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