aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/control/parser/xml.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/control/parser/xml.lux24
1 files changed, 12 insertions, 12 deletions
diff --git a/stdlib/source/lux/control/parser/xml.lux b/stdlib/source/lux/control/parser/xml.lux
index be5c0f7b6..f9ac14f8f 100644
--- a/stdlib/source/lux/control/parser/xml.lux
+++ b/stdlib/source/lux/control/parser/xml.lux
@@ -3,9 +3,9 @@
[abstract
[monad (#+ do)]]
[control
+ ["." try (#+ Try)]
["." exception (#+ exception:)]]
[data
- ["." error (#+ Error)]
["." name ("#@." equivalence codec)]
["." text ("#@." monoid)]
[collection
@@ -43,7 +43,7 @@
(#.Cons head tail)
(case head
(#/.Text value)
- (#error.Success [tail value])
+ (#try.Success [tail value])
(#/.Node _)
(exception.throw unexpected-input [])))))
@@ -66,18 +66,18 @@
(exception.throw unknown-attribute [])
(#.Some value)
- (#error.Success [docs value]))))))
+ (#try.Success [docs value]))))))
(def: (run' reader docs)
- (All [a] (-> (Parser a) (List XML) (Error a)))
+ (All [a] (-> (Parser a) (List XML) (Try a)))
(case (//.run reader docs)
- (#error.Success [remaining output])
+ (#try.Success [remaining output])
(if (list.empty? remaining)
- (#error.Success output)
+ (#try.Success output)
(exception.throw unconsumed-inputs remaining))
- (#error.Failure error)
- (#error.Failure error)))
+ (#try.Failure error)
+ (#try.Failure error)))
(def: #export (node tag)
(-> Name (Parser Any))
@@ -93,7 +93,7 @@
(#/.Node _tag _attrs _children)
(if (name@= tag _tag)
- (#error.Success [docs []])
+ (#try.Success [docs []])
(exception.throw wrong-tag tag))))))
(def: #export (children reader)
@@ -109,7 +109,7 @@
(exception.throw unexpected-input [])
(#/.Node _tag _attrs _children)
- (do error.monad
+ (do try.monad
[output (run' reader _children)]
(wrap [tail output]))))))
@@ -121,8 +121,8 @@
(exception.throw empty-input [])
(#.Cons head tail)
- (#error.Success [tail []]))))
+ (#try.Success [tail []]))))
(def: #export (run reader document)
- (All [a] (-> (Parser a) XML (Error a)))
+ (All [a] (-> (Parser a) XML (Try a)))
(run' reader (list document)))