Skip to content

Commit 33e1fbf

Browse files
committed
Add showConstr function
1 parent 1e1472c commit 33e1fbf

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/Lapse/Types.hs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,16 @@ instance A.FromJSON Value where
130130
A.Bool b -> pure $ if b then Number 1 else Number 0
131131
A.Array arr -> pure $ foldr (Pair . unsafeFromJSON) Nil $ toList arr
132132
A.Object obj -> Dict <$> A.parseJSON (A.Object obj)
133+
134+
showConstr :: Value -> String
135+
showConstr = \case
136+
Number _ -> "number"
137+
Float _ -> "float"
138+
String _ -> "string"
139+
Name _ -> "name"
140+
Function _ -> "function"
141+
Macros _ -> "macros"
142+
Pair _ _ -> "list"
143+
Nil -> "()"
144+
Dict _ -> "dict"
145+
External _ -> "external"

0 commit comments

Comments
 (0)