1. kimagure

    No comment

Changes in body
Source | HTML | Preview
@@ -142,21 +142,25 @@
-- | Type alias for a validated string and its rules
type ValidatedValue (rules :: # Type) a = Const a (RProxy rules)
+-- | Type alias for a string validation result,
+-- | with a list of labels that failed validation
+type VS errors rules a =
+ V (NonEmptyList (Variant errors)) (ValidatedValue rules a)
+-- | Check a string for validation rules provided by a row proxy
+-- | and return a validation result
checkRules :: forall a row errors rl
. RowToList row rl
=> CheckRules rl errors row a
=> RProxy row
-> a
-> VS errors row a
-checkRules _ str = const (Const str) <$> checkRulesImpl (RLProxy :: RLProxy rl) str
+checkRules _ str =
+ const (Const str) <$> checkRulesImpl (RLProxy :: RLProxy rl) str
So out of the relatively "simple" idea of applicative validation, I was able to create a library on top that provides further power in modeling correct code paths. I wrote about this more [here](https://qiita.com/kimagure/items/eeb40541fc56b8dba2cc), so please check it out if you're interested.
## Conclusion