aboutsummaryrefslogtreecommitdiff
path: root/licentia/source/program
diff options
context:
space:
mode:
Diffstat (limited to 'licentia/source/program')
-rw-r--r--licentia/source/program/licentia/input.lux19
1 files changed, 11 insertions, 8 deletions
diff --git a/licentia/source/program/licentia/input.lux b/licentia/source/program/licentia/input.lux
index afc723656..f1166d865 100644
--- a/licentia/source/program/licentia/input.lux
+++ b/licentia/source/program/licentia/input.lux
@@ -4,7 +4,7 @@
[abstract
[monad (.only do)]]
[control
- ["[0]" exception (.only exception)]
+ ["[0]" exception (.only Exception)]
["<>" parser]]
[data
[text
@@ -38,13 +38,15 @@
(<json>.field "name" <json>.string)
(<json>.field "version" <json>.string))))
-(exception .public (cannot_use_fractional_amount [amount Frac])
- (exception.report
- (list ["Amount" (%.frac amount)])))
+(with_template [<name> <type> <format>]
+ (exception.def .public (cannot_use_fractional_amount it)
+ (Exception <type>)
+ (exception.report
+ (list ["Amount" (<format> it)])))
-(exception .public (cannot_use_negative_amount [amount Int])
- (exception.report
- (list ["Amount" (%.int amount)])))
+ [cannot_use_fractional_amount Frac %.frac]
+ [cannot_use_negative_amount Int %.int]
+ )
(def amount
(Parser Nat)
@@ -58,7 +60,8 @@
(i.> +0 amountI))]
(wrap (.nat amountI))))
-(exception .public (invalid_period [period (Period Nat)])
+(exception.def .public (invalid_period period)
+ (Exception (Period Nat))
(exception.report
(list ["Start" (%.nat (the time.#start period))]
["End" (%.nat (the time.#end period))])))