Skip to content

Commit

Permalink
Fix showTerm not displaying empty pis correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
WhatisRT committed Dec 30, 2023
1 parent 9d7a073 commit 28a4ce8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion mced/Bootstrap/Stage-3/ShowTerm.mced
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ b-let showVar (con : List String) (v : Var) : String :=
b-let showSort (s : Sort) : String := s ?String "*" "□".
b-let showBinder (b : Binder) : String := b ?String "λ" "Λ" "Π" "∀".

b-let emptyName (n : String) : Bool := or (stringEq n "") (stringEq n "_").
b-let isArrow (b : Binder) : Bool := b ?Bool false false true true.
b-let showBinderArrow (b : Binder) : String := b ?String "λ is not an arrow!" "Λ is not an arrow!" "->" "=>".

Expand All @@ -47,7 +48,7 @@ b-let showTermWithContext (t : Term) : List String -> String := recursionTerm ?(
(λ v : Var. λ con : List String. showVar con v)
(λ s : Sort. λ _ : List String. showSort s)
(λ b : Binder. λ n : String. λ _, _ : Term. λ T, t : List String -> String. λ con : List String.
ifthenelse ?String (and (stringEq n "_") (isArrow b))
ifthenelse ?String (and (isArrow b) (emptyName n))
φ"${T con} ${showBinderArrow b} ${t (cons ?String n con)}"
φ"${showBinder b} ${n} : ${T con}. ${t (cons ?String n con)}")
(λ _ : Term. λ la : List App. λ t : List String -> String.
Expand Down
3 changes: 2 additions & 1 deletion mced/Test/Bootstrap/ShowTerm.mced
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ elet showVar (con : List String) (v : Var) : String :=
let showSort (s : Sort) : String := s ?String "*" "□".
let showBinder (b : Binder) : String := b ?String "λ" "Λ" "Π" "∀".

let emptyName (n : String) : Bool := or (stringEq n "") (stringEq n "_").
let isArrow (b : Binder) : Bool := b ?Bool false false true true.
let showBinderArrow (b : Binder) : String :=
b ?String "λ is not an arrow!" "Λ is not an arrow!" "->" "=>".
Expand All @@ -58,7 +59,7 @@ elet showTermWithContext : Term -> List String -> String := recursionTerm ?_
(λ v : Var. λ con : List String. showVar con v)
(λ s : Sort. λ _ : List String. showSort s)
(λ b : Binder. λ n : String. λ _, _ : Term. λ T, t : List String -> String. λ con : List String.
ifthenelse ?_ (and (stringEq n "_") (isArrow b))
ifthenelse ?_ (and (isArrow b) (emptyName n))
φ"${T con} ${showBinderArrow b} ${t (n ∷ con)}"
φ"${showBinder b} ${n} : ${T con}. ${t (n ∷ con)}")
(λ _ : Term. λ la : List App. λ t : List String -> String.
Expand Down

0 comments on commit 28a4ce8

Please sign in to comment.