aboutsummaryrefslogtreecommitdiff
path: root/client/src/Util
diff options
context:
space:
mode:
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