aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/data/format
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/lux/data/format')
-rw-r--r--stdlib/source/lux/data/format/binary.lux12
-rw-r--r--stdlib/source/lux/data/format/context.lux4
-rw-r--r--stdlib/source/lux/data/format/json.lux30
-rw-r--r--stdlib/source/lux/data/format/xml.lux26
4 files changed, 36 insertions, 36 deletions
diff --git a/stdlib/source/lux/data/format/binary.lux b/stdlib/source/lux/data/format/binary.lux
index 4657b48d5..b21887854 100644
--- a/stdlib/source/lux/data/format/binary.lux
+++ b/stdlib/source/lux/data/format/binary.lux
@@ -47,8 +47,8 @@
(def: #export (read format input)
(All [a] (-> (Format a) Binary (Error a)))
(case ((get@ #read format) [0 input])
- (#error.Error msg)
- (#error.Error msg)
+ (#error.Failure msg)
+ (#error.Failure msg)
(#error.Success [[end _] output])
(let [length (binary.size input)]
@@ -70,8 +70,8 @@
(#error.Success data)
(#error.Success [(n/+ <size> offset) binary] data)
- (#error.Error error)
- (#error.Error error)))
+ (#error.Failure error)
+ (#error.Failure error)))
#write (function (_ value)
[<size>
(function (_ offset binary)
@@ -163,8 +163,8 @@
_
(ex.throw invalid-tag [2 data]))
- (#error.Error error)
- (#error.Error error)))
+ (#error.Failure error)
+ (#error.Failure error)))
#write (function (_ value)
[1
(function (_ offset binary)
diff --git a/stdlib/source/lux/data/format/context.lux b/stdlib/source/lux/data/format/context.lux
index b5d86139a..749185f85 100644
--- a/stdlib/source/lux/data/format/context.lux
+++ b/stdlib/source/lux/data/format/context.lux
@@ -36,5 +36,5 @@
(#error.Success [_ output])
(#error.Success output)
- (#error.Error error)
- (#error.Error error)))
+ (#error.Failure error)
+ (#error.Failure error)))
diff --git a/stdlib/source/lux/data/format/json.lux b/stdlib/source/lux/data/format/json.lux
index 63075804e..7d2e90270 100644
--- a/stdlib/source/lux/data/format/json.lux
+++ b/stdlib/source/lux/data/format/json.lux
@@ -102,7 +102,7 @@
(#error.Success (dictionary.keys obj))
_
- (#error.Error ($_ text/compose "Cannot get the fields of a non-object."))))
+ (#error.Failure ($_ text/compose "Cannot get the fields of a non-object."))))
(def: #export (get key json)
{#.doc "A JSON object field getter."}
@@ -114,10 +114,10 @@
(#error.Success value)
#.None
- (#error.Error ($_ text/compose "Missing field '" key "' on object.")))
+ (#error.Failure ($_ text/compose "Missing field '" key "' on object.")))
_
- (#error.Error ($_ text/compose "Cannot get field '" key "' of a non-object."))))
+ (#error.Failure ($_ text/compose "Cannot get field '" key "' of a non-object."))))
(def: #export (set key value json)
{#.doc "A JSON object field setter."}
@@ -127,7 +127,7 @@
(#error.Success (#Object (dictionary.put key value obj)))
_
- (#error.Error ($_ text/compose "Cannot set field '" key "' of a non-object."))))
+ (#error.Failure ($_ text/compose "Cannot set field '" key "' of a non-object."))))
(do-template [<name> <tag> <type> <desc>]
[(def: #export (<name> key json)
@@ -138,10 +138,10 @@
(#error.Success value)
(#error.Success _)
- (#error.Error ($_ text/compose "Wrong value type at key: " key))
+ (#error.Failure ($_ text/compose "Wrong value type at key: " key))
- (#error.Error error)
- (#error.Error error)))]
+ (#error.Failure error)
+ (#error.Failure error)))]
[get-boolean #Boolean Boolean "booleans"]
[get-number #Number Number "numbers"]
@@ -258,13 +258,13 @@
_
(ex.throw unconsumed-input remainder))
- (#error.Error error)
- (#error.Error error)))
+ (#error.Failure error)
+ (#error.Failure error)))
(def: #export (fail error)
(All [a] (-> Text (Reader a)))
(function (_ inputs)
- (#error.Error error)))
+ (#error.Failure error)))
(def: #export any
{#.doc "Just returns the JSON input without applying any logic."}
@@ -342,7 +342,7 @@
(case head
(#Array values)
(case (p.run (row.to-list values) parser)
- (#error.Error error)
+ (#error.Failure error)
(fail error)
(#error.Success [remainder output])
@@ -369,7 +369,7 @@
(list (#String key) value)))
list.concat)
parser)
- (#error.Error error)
+ (#error.Failure error)
(fail error)
(#error.Success [remainder output])
@@ -397,8 +397,8 @@
(#error.Success [inputs'' _])
(ex.throw unconsumed-input inputs'')
- (#error.Error error)
- (#error.Error error))
+ (#error.Failure error)
+ (#error.Failure error))
(do error.Monad<Error>
[[inputs'' output] (recur inputs')]
(wrap [(list& (#String key) value inputs'')
@@ -459,7 +459,7 @@
offset (l.many l.decimal)]
(wrap ($_ text/compose mark (if signed?' "-" "") offset))))]
(case (frac/decode ($_ text/compose (if signed? "-" "") digits "." decimals exp))
- (#error.Error message)
+ (#error.Failure message)
(p.fail message)
(#error.Success value)
diff --git a/stdlib/source/lux/data/format/xml.lux b/stdlib/source/lux/data/format/xml.lux
index 0ed744b46..e1cbda0db 100644
--- a/stdlib/source/lux/data/format/xml.lux
+++ b/stdlib/source/lux/data/format/xml.lux
@@ -8,7 +8,7 @@
["ex" exception (#+ exception:)]]
[data
["." number]
- ["E" error]
+ ["." error (#+ Error)]
["." product]
["." name ("name/." Equivalence<Name> Codec<Text,Name>)]
["." text ("text/." Equivalence<Text> Monoid<Text>)
@@ -171,7 +171,7 @@
(p.after (p.maybe xml-header^))))
(def: #export (read input)
- (-> Text (E.Error XML))
+ (-> Text (Error XML))
(l.run input xml^))
(def: (sanitize-value input)
@@ -271,7 +271,7 @@
(#.Cons head tail)
(case head
(#Text value)
- (#E.Success [tail value])
+ (#error.Success [tail value])
(#Node _)
(ex.throw unexpected-input [])))))
@@ -294,18 +294,18 @@
(ex.throw unknown-attribute [])
(#.Some value)
- (#E.Success [docs value]))))))
+ (#error.Success [docs value]))))))
(def: (run' docs reader)
- (All [a] (-> (List XML) (Reader a) (E.Error a)))
+ (All [a] (-> (List XML) (Reader a) (Error a)))
(case (p.run docs reader)
- (#E.Success [remaining output])
+ (#error.Success [remaining output])
(if (list.empty? remaining)
- (#E.Success output)
+ (#error.Success output)
(ex.throw unconsumed-inputs remaining))
- (#E.Error error)
- (#E.Error error)))
+ (#error.Failure error)
+ (#error.Failure error)))
(def: #export (node tag)
(-> Name (Reader Any))
@@ -321,7 +321,7 @@
(#Node _tag _attrs _children)
(if (name/= tag _tag)
- (#E.Success [docs []])
+ (#error.Success [docs []])
(ex.throw wrong-tag tag))))))
(def: #export (children reader)
@@ -337,7 +337,7 @@
(ex.throw unexpected-input [])
(#Node _tag _attrs _children)
- (do E.Monad<Error>
+ (do error.Monad<Error>
[output (run' _children reader)]
(wrap [tail output]))))))
@@ -349,8 +349,8 @@
(ex.throw empty-input [])
(#.Cons head tail)
- (#E.Success [tail []]))))
+ (#error.Success [tail []]))))
(def: #export (run document reader)
- (All [a] (-> XML (Reader a) (E.Error a)))
+ (All [a] (-> XML (Reader a) (Error a)))
(run' (list document) reader))