Module
HomeRunBall
- Package
- purescript-home-run-ball
- Repository
- justinwoo/purescript-home-run-ball
#checkRules Source
checkRules :: forall rl errors row a. RowToList row rl => CheckRules rl errors row a => RProxy row -> a -> VS errors row a
Check a string for validation rules provided by a row proxy and return a validation result
#BeginsWith Source
data BeginsWith (s :: Symbol)
Rule for checking what the string begins with
Instances
(IsSymbol prefix) => ValidateRule (BeginsWith prefix) String
#Capitalized Source
#ValidatedValue Source
type ValidatedValue (rules :: Row Type) a = Const a (RProxy rules)
Type alias for a validated string and its rules
#VS Source
type VS errors rules a = V (NonEmptyList (Variant errors)) (ValidatedValue rules a)
Type alias for a string validation result, with a list of labels that failed validation
#ValidateRule Source
class ValidateRule rule a where
Members
validateRuleImpl :: Proxy rule -> a -> Boolean
Instances
(IsSymbol prefix) => ValidateRule (BeginsWith prefix) String
(IsSymbol suffix) => ValidateRule (EndsWith suffix) String
(IsSymbol thingy) => ValidateRule (Contains thingy) String
ValidateRule Capitalized String
ValidateRule AllCaps String
ValidateRule Lowercase String
#CheckRules Source
class CheckRules (rl :: RowList) (errors :: Row Type) (rules :: Row Type) a | rl -> errors rules where
Members
checkRulesImpl :: RLProxy rl -> a -> V (NonEmptyList (Variant errors)) Unit
Instances
(IsSymbol name, CheckRules tail errors rules a, Cons name String trash errors, ValidateRule ty a) => CheckRules (Cons name ty tail) errors rules a
CheckRules Nil errors rules a
- Modules
- HomeRunBall