aboutsummaryrefslogtreecommitdiff
path: root/client/src/Util
diff options
context:
space:
mode:
authorJoris2019-08-08 21:28:22 +0200
committerJoris2019-08-08 21:28:22 +0200
commit7c77e52faa71e43324087903c905f9d493b1dfb7 (patch)
tree5bf5096cbfaaec0ea851f49e5022ed1ecfd17657 /client/src/Util
parentfc8be14dd0089eb12b78af7aaaecd8ed57896677 (diff)
Finish payment add modal
Diffstat (limited to 'client/src/Util')
-rw-r--r--client/src/Util/Validation.hs9
1 files changed, 7 insertions, 2 deletions
diff --git a/client/src/Util/Validation.hs b/client/src/Util/Validation.hs
index fc13f36..f9545a4 100644
--- a/client/src/Util/Validation.hs
+++ b/client/src/Util/Validation.hs
@@ -1,6 +1,7 @@
module Util.Validation
( nelError
, toMaybe
+ , maybeError
, fireValidation
, fireMaybe
) where
@@ -21,14 +22,18 @@ toMaybe :: Validation a b -> Maybe b
toMaybe (Success s) = Just s
toMaybe (Failure _) = Nothing
+maybeError :: Validation a b -> Maybe a
+maybeError (Success _) = Nothing
+maybeError (Failure e) = Just e
+
fireValidation
:: forall t a b c. Reflex t
- => Dynamic t (Maybe (Validation a b))
+ => Dynamic t (Validation a b)
-> Event t c
-> Event t b
fireValidation value validate =
R.fmapMaybe
- (join . fmap (Validation.validation (const Nothing) Just))
+ (Validation.validation (const Nothing) Just)
(R.tag (R.current value) validate)
fireMaybe