blob: 18ceb4447cfa32a9ee1a91a0a895ecc8a52f14d3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
module Common.Validation.SignIn
( signIn
, email
) where
import Data.Text (Text)
import Data.Validation (Validation)
import Common.Model.Email (Email (..))
import Common.Model.SignInForm (SignInForm (..))
import qualified Common.Validation.Atomic as Atomic
import qualified Data.Validation as Validation
signIn :: SignInForm -> Maybe Email
signIn (SignInForm str) =
Validation.validation (const Nothing) Just . email $ str
email :: Text -> Validation Text Email
email = fmap Email . Atomic.minLength 5
|