diff options
author | William Carroll <wpcarro@gmail.com> | 2022-10-24T21·51-0400 |
---|---|---|
committer | wpcarro <wpcarro@gmail.com> | 2022-10-25T03·59+0000 |
commit | 1e9c3955bf2c17206c6dd536ebaf96a7e6f4f22d (patch) | |
tree | 3ad05bbd2f8c6fc7ccfe8e6e507fe386d9957a75 /users/wpcarro/scratch/compiler/prettify.ml | |
parent | a8876a4cdaaf0a1f051fefad436e08d983b402e2 (diff) |
refactor(wpcarro/compiler): Modularize debug fns r/5195
Define `debug.ml` and `prettify.ml` to clean-up some code. Change-Id: Iee2e1ed666f2ccb5e56cc50054ca85b8ba513f3b Reviewed-on: https://cl.tvl.fyi/c/depot/+/7078 Tested-by: BuildkiteCI Reviewed-by: wpcarro <wpcarro@gmail.com>
Diffstat (limited to 'users/wpcarro/scratch/compiler/prettify.ml')
-rw-r--r-- | users/wpcarro/scratch/compiler/prettify.ml | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/users/wpcarro/scratch/compiler/prettify.ml b/users/wpcarro/scratch/compiler/prettify.ml new file mode 100644 index 000000000000..7903ad36947c --- /dev/null +++ b/users/wpcarro/scratch/compiler/prettify.ml @@ -0,0 +1,9 @@ +open Types + +(* Pretty-print the type, t. *) +let rec type' (t : _type) : string = + match t with + | TypeInt -> "Integer" + | TypeBool -> "Boolean" + | TypeVariable k -> Printf.sprintf "%s" k + | TypeArrow (a, b) -> Printf.sprintf "%s -> %s" (type' a) (type' b) |