diff options
author | Joris | 2020-01-04 19:22:45 +0100 |
---|---|---|
committer | Joris | 2020-01-04 19:22:45 +0100 |
commit | da2a0c13aa89705c65fdb9df2f496fb4eea29654 (patch) | |
tree | 760e267f0215349af1d5e7c10c84a04bcb5bc75c /common/src/Common/Validation | |
parent | 1dfb85d3fd56d163fc854a8b3cf659d0ac39f639 (diff) |
Allow to remove only unused categories
Diffstat (limited to 'common/src/Common/Validation')
-rw-r--r-- | common/src/Common/Validation/Atomic.hs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/common/src/Common/Validation/Atomic.hs b/common/src/Common/Validation/Atomic.hs index 2a356df..4bb7cad 100644 --- a/common/src/Common/Validation/Atomic.hs +++ b/common/src/Common/Validation/Atomic.hs @@ -7,6 +7,7 @@ module Common.Validation.Atomic , color ) where +import qualified Data.Char as Char import Data.Text (Text) import qualified Data.Text as T import Data.Time.Calendar (Day) @@ -47,6 +48,10 @@ day str = Just d -> V.Success d Nothing -> V.Failure $ Msg.get Msg.Form_InvalidDate --- TODO: validate color :: Text -> Validation Text Text -color str = V.Success str +color str = + if T.take 1 str == "#" && T.all Char.isHexDigit (T.drop 1 str) then + V.Success str + + else + V.Failure (Msg.get Msg.Form_InvalidColor) |