diff options
author | Joris | 2019-10-20 12:02:21 +0200 |
---|---|---|
committer | Joris | 2019-10-20 12:02:21 +0200 |
commit | 7aadcc97f9df0e2daccbe8a8726d8bc6c63d67f4 (patch) | |
tree | 3637cc06f6378fc3ea04844f15fe43bc04155007 /common/src/Common/Validation | |
parent | 6e9e34e92a244ab6c38d135d46f9f5bb01391906 (diff) |
Add income
Diffstat (limited to 'common/src/Common/Validation')
-rw-r--r-- | common/src/Common/Validation/Income.hs | 17 | ||||
-rw-r--r-- | common/src/Common/Validation/Payment.hs | 1 |
2 files changed, 17 insertions, 1 deletions
diff --git a/common/src/Common/Validation/Income.hs b/common/src/Common/Validation/Income.hs new file mode 100644 index 0000000..7a58bab --- /dev/null +++ b/common/src/Common/Validation/Income.hs @@ -0,0 +1,17 @@ +module Common.Validation.Income + ( amount + , date + ) where + +import Data.Text (Text) +import Data.Time.Calendar (Day) +import Data.Validation (Validation) +import qualified Data.Validation as V + +import qualified Common.Validation.Atomic as Atomic + +amount :: Text -> Validation Text Int +amount input = V.bindValidation (Atomic.number input) Atomic.nonNullNumber + +date :: Text -> Validation Text Day +date = Atomic.day diff --git a/common/src/Common/Validation/Payment.hs b/common/src/Common/Validation/Payment.hs index 1bb00ce..e3c447a 100644 --- a/common/src/Common/Validation/Payment.hs +++ b/common/src/Common/Validation/Payment.hs @@ -14,7 +14,6 @@ import Common.Model (CategoryId) import qualified Common.Msg as Msg import qualified Common.Validation.Atomic as Atomic - name :: Text -> Validation Text Text name = Atomic.nonEmpty |