diff options
author | Joris | 2021-01-03 13:40:40 +0100 |
---|---|---|
committer | Joris | 2021-01-03 13:54:20 +0100 |
commit | 11052951b74b9ad4b6a9412ae490086235f9154b (patch) | |
tree | 64526ac926c1bf470ea113f6cac8a33158684e8d /client/src/Util/Validation.hs | |
parent | 371449b0e312a03162b78797b83dee9d81706669 (diff) |
Rewrite in Rust
Diffstat (limited to 'client/src/Util/Validation.hs')
-rw-r--r-- | client/src/Util/Validation.hs | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/client/src/Util/Validation.hs b/client/src/Util/Validation.hs deleted file mode 100644 index 50f2468..0000000 --- a/client/src/Util/Validation.hs +++ /dev/null @@ -1,36 +0,0 @@ -module Util.Validation - ( nelError - , toMaybe - , maybeError - , fireValidation - ) where - -import Control.Monad (join) -import Data.List.NonEmpty (NonEmpty) -import qualified Data.List.NonEmpty as NEL -import Data.Text (Text) -import Data.Validation (Validation (Failure, Success)) -import qualified Data.Validation as Validation -import Reflex.Dom (Dynamic, Event, Reflex) -import qualified Reflex.Dom as R - -nelError :: Validation a b -> Validation (NonEmpty a) b -nelError = Validation.validation (Failure . NEL.fromList . (:[])) Success - -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 (Validation a b) - -> Event t c - -> Event t b -fireValidation value validate = - R.fmapMaybe - (Validation.validation (const Nothing) Just) - (R.tag (R.current value) validate) |