From 8ba4a462010c1c0f5b3fedec2c73205c314c7162 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Tue, 2 Jan 2018 00:03:06 -0400 Subject: - Added lux/macro.log-type macro for easier debugging. --- stdlib/source/lux/macro.lux | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'stdlib') diff --git a/stdlib/source/lux/macro.lux b/stdlib/source/lux/macro.lux index 7a01c98be..27329e55c 100644 --- a/stdlib/source/lux/macro.lux +++ b/stdlib/source/lux/macro.lux @@ -9,7 +9,8 @@ [maybe] ["e" error] [text "text/" Monoid Eq] - (coll [list "list/" Monoid Monad]))) + (coll [list "list/" Monoid Monad])) + (lang [type])) (/ [code])) ## (type: (Meta a) @@ -700,3 +701,22 @@ [log-expand-all expand-all "log-expand-all"] [log-expand-once expand-once "log-expand-once"] ) + +(macro: #export (log-type tokens) + (case tokens + (#.Cons [_ (#.Symbol valueN)] #.Nil) + (do Monad + [valueT (find-type valueN) + #let [_ (log! ($_ text/compose (code.to-text (code.symbol valueN)) " : " (type.to-text valueT)))]] + (wrap (list (' [])))) + + (#.Cons valueC #.Nil) + (|> (` (.let [(~ g!value) (~ valueC)] + (..log-type (~ g!value)))) + (let [g!value (code.local-symbol (code.to-text valueC))]) + list + (:: Monad wrap)) + + _ + (fail "Wrong syntax for log-type.") + )) -- cgit v1.2.3