diff options
author | Eduardo Julian | 2018-01-02 00:03:06 -0400 |
---|---|---|
committer | Eduardo Julian | 2018-01-02 00:03:06 -0400 |
commit | 8ba4a462010c1c0f5b3fedec2c73205c314c7162 (patch) | |
tree | b974730795c22617603b8618e9a126b664cd3a4f | |
parent | d753da4dd2fa8dea89f3b8f24a40d6fde024f79a (diff) |
- Added lux/macro.log-type macro for easier debugging.
-rw-r--r-- | stdlib/source/lux/macro.lux | 22 |
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.") + )) |