aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source')
-rw-r--r--stdlib/source/lux/type.lux21
1 files changed, 17 insertions, 4 deletions
diff --git a/stdlib/source/lux/type.lux b/stdlib/source/lux/type.lux
index fd02c1497..15f284d10 100644
--- a/stdlib/source/lux/type.lux
+++ b/stdlib/source/lux/type.lux
@@ -4,9 +4,10 @@
[equivalence (#+ Equivalence)]
[monad (#+ Monad do)]]
[control
+ ["." function]
+ ["." exception (#+ exception:)]
["p" parser
- ["s" code (#+ Parser)]]
- ["." function]]
+ ["s" code (#+ Parser)]]]
[data
["." text ("#@." monoid equivalence)]
["." name ("#@." equivalence codec)]
@@ -357,8 +358,9 @@
[cursor macro.cursor
valueT (macro.find-type valueN)
#let [_ (log! ($_ text@compose
- ":log!" " @ " (.cursor-description cursor) text.new-line
- (name@encode valueN) " : " (..to-text valueT) text.new-line))]]
+ (name@encode (name-of ..:log!)) " @ " (.cursor-description cursor) text.new-line
+ "Value: " (name@encode valueN) text.new-line
+ " Type: " (..to-text valueT) text.new-line))]]
(wrap (list (code.identifier valueN))))
(#.Right valueC)
@@ -413,3 +415,14 @@
(~ (get@ #expression exemplar))}
{(~ extraction)
(:assume [])}))))))
+
+(exception: #export (hole-type {location Cursor} {type Type})
+ (exception.report
+ ["Location" (.cursor-description location)]
+ ["Type" (..to-text type)]))
+
+(syntax: #export (:hole)
+ (do @
+ [cursor macro.cursor
+ expectedT macro.expected-type]
+ (macro.fail (exception.construct ..hole-type [cursor expectedT]))))