summaryrefslogtreecommitdiff
path: root/lib/operation.ml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/operation.ml')
-rw-r--r--lib/operation.ml2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/operation.ml b/lib/operation.ml
index bce6ac2..54962fd 100644
--- a/lib/operation.ml
+++ b/lib/operation.ml
@@ -47,7 +47,7 @@ let decoder : transaction_op Utils.Decoder.decoder =
<|> literal "d" *> return (fun p -> `Debit p)
in
(fun value transaction_type description -> transaction_type { value; description })
- <$> ("valor" <: int)
+ <$> ("valor" <: (int >>= fun x -> if x >= 0 then return x else fail))
<*> ("tipo" <: transaction_type_decoder)
<*> ("descricao"
<: (string