luau/prototyping/Examples/Type.agda
Alan Jeffrey db90c7da48
Add a typeToString function to the prototype (#354)
* Added Luau.Type.ToString
2022-02-11 14:38:35 -06:00

27 lines
860 B
Agda
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 Examples.Type where
open import Agda.Builtin.Equality using (_≡_; refl)
open import FFI.Data.String using (_++_)
open import Luau.Type using (nil; __; _∩_; _⇒_)
open import Luau.Type.ToString using (typeToString)
ex1 : typeToString(nil) "nil"
ex1 = refl
ex2 : typeToString(nil nil) "(nil) -> nil"
ex2 = refl
ex3 : typeToString(nil (nil nil)) "(nil) -> (nil) -> nil"
ex3 = refl
ex4 : typeToString(nil (nil (nil nil))) "((nil) -> (nil) -> nil)?"
ex4 = refl
ex5 : typeToString(nil ((nil nil) nil)) "(nil) -> ((nil) -> nil)?"
ex5 = refl
ex6 : typeToString((nil nil) (nil (nil nil))) "((nil) -> nil | (nil) -> (nil) -> nil)"
ex6 = refl
ex7 : typeToString((nil nil) ((nil (nil nil)) nil)) "((nil) -> nil | (nil) -> (nil) -> nil)?"
ex7 = refl