diff options
author | Eduardo Julian | 2019-06-18 23:19:23 -0400 |
---|---|---|
committer | Eduardo Julian | 2019-06-18 23:19:23 -0400 |
commit | 75e6f7ad181d398b818367fdc5e86b1542d1bc0a (patch) | |
tree | d0ea084f2d9f35876d4ab383d3830445588ee323 /stdlib | |
parent | 4bf2dce01f51a5b0be76a587f877d1227c3982ae (diff) |
Implemented "hole" typing.
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/type.lux | 21 |
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])))) |