A start on Joy types.

This commit is contained in:
sforman 2023-07-28 15:04:35 -07:00
parent 590a5b207c
commit 9d57545533
1 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,25 @@
module Joy exposing (joyTermToString)
type JoyType
= Symbol String
| Integer Int
| JoyList (List JoyType)
| JoyTrue
| JoyFalse
joyTermToString : JoyType -> String
joyTermToString term =
case term of
Symbol name ->
name
Integer n ->
String.fromInt n
JoyTrue ->
"true"
JoyFalse ->
"false"
JoyList list ->
"[" ++ (String.join " " (List.map joyTermToString list)) ++ "]"