aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/macro.lux22
1 files changed, 21 insertions, 1 deletions
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<Text> Eq<Text>]
- (coll [list "list/" Monoid<List> Monad<List>])))
+ (coll [list "list/" Monoid<List> Monad<List>]))
+ (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<Meta>
+ [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<Meta> wrap))
+
+ _
+ (fail "Wrong syntax for log-type.")
+ ))