File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -123,9 +123,9 @@ objectValues str val = do
123
123
-- Why use acc pattern here, you may ask? because 'H.fromList' use 'unsafeInsert'
124
124
-- and it's much faster because it's doing in place update to the 'HashMap'!
125
125
loop acc = do
126
- k <- str < * skipSpace <* char ' :'
127
- v <- val <* skipSpace
128
- ch <- A. satisfy $ \ w -> w == COMMA || w == CLOSE_CURLY
126
+ k <- ( str A. <?> " expected object key " ) < * skipSpace <* ( char ' :' A. <?> " expecting ':' " )
127
+ v <- ( val A. <?> " expected object value " ) <* skipSpace
128
+ ch <- ( A. satisfy $ \ w -> w == COMMA || w == CLOSE_CURLY ) A. <?> " expecting ',' or '}' "
129
129
let acc' = (k, v) : acc
130
130
if ch == COMMA
131
131
then skipSpace >> loop acc'
@@ -149,8 +149,8 @@ arrayValues val = do
149
149
else loop [] 1
150
150
where
151
151
loop acc ! len = do
152
- v <- val <* skipSpace
153
- ch <- A. satisfy $ \ w -> w == COMMA || w == CLOSE_SQUARE
152
+ v <- ( val A. <?> " expected json list value " ) <* skipSpace
153
+ ch <- ( A. satisfy $ \ w -> w == COMMA || w == CLOSE_SQUARE ) A. <?> " expecting ',' or ']' "
154
154
if ch == COMMA
155
155
then skipSpace >> loop (v: acc) (len+ 1 )
156
156
else return (Vector. reverse (Vector. fromListN len (v: acc)))
You can’t perform that action at this time.
0 commit comments