This commit is contained in:
ajeffrey@roblox.com 2022-02-24 11:34:11 -06:00
parent 02f5e21331
commit 9f6fc4a56b
2 changed files with 3 additions and 4 deletions

View file

@ -1,5 +1,3 @@
{-# OPTIONS --allow-unsolved-metas #-}
module Examples.Type where module Examples.Type where
open import Agda.Builtin.Equality using (_≡_; refl) open import Agda.Builtin.Equality using (_≡_; refl)
@ -26,5 +24,5 @@ ex6 : typeToString((nil ⇒ nil) (nil ⇒ (nil ⇒ nil))) ≡ "((nil) -> nil
ex6 = refl ex6 = refl
ex7 : typeToString((nil nil) ((nil (nil nil)) nil)) "((nil) -> nil | (nil) -> (nil) -> nil)?" ex7 : typeToString((nil nil) ((nil (nil nil)) nil)) "((nil) -> nil | (nil) -> (nil) -> nil)?"
ex7 = {!!} ex7 = refl

View file

@ -15,12 +15,13 @@ typeToString top = "top"
typeToString number = "number" typeToString number = "number"
typeToString (S T) with normalizeOptional(S T) typeToString (S T) with normalizeOptional(S T)
typeToString (S T) | ((S T) nil) = "(" ++ typeToString (S T) ++ ")?" typeToString (S T) | ((S T) nil) = "(" ++ typeToString (S T) ++ ")?"
typeToString (S T) | (S nil) = "(" ++ typeToString S ++ "?" typeToString (S T) | (S nil) = typeToString S ++ "?"
typeToString (S T) | (S T) = "(" ++ typeToStringᵁ (S T) ++ ")" typeToString (S T) | (S T) = "(" ++ typeToStringᵁ (S T) ++ ")"
typeToString (S T) | T = typeToString T typeToString (S T) | T = typeToString T
typeToString (S T) = "(" ++ typeToStringᴵ (S T) ++ ")" typeToString (S T) = "(" ++ typeToStringᴵ (S T) ++ ")"
typeToStringᵁ (S T) = (typeToStringᵁ S) ++ " | " ++ (typeToStringᵁ T) typeToStringᵁ (S T) = (typeToStringᵁ S) ++ " | " ++ (typeToStringᵁ T)
typeToStringᵁ T = typeToString T typeToStringᵁ T = typeToString T
typeToStringᴵ (S T) = (typeToStringᴵ S) ++ " & " ++ (typeToStringᴵ T) typeToStringᴵ (S T) = (typeToStringᴵ S) ++ " & " ++ (typeToStringᴵ T)
typeToStringᴵ T = typeToString T typeToStringᴵ T = typeToString T