File tree 1 file changed +3
-3
lines changed
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -584,16 +584,16 @@ optionally (Validator v) = Validator $ maybe (Success Nothing) (fmap Just . v)
584
584
585
585
Yields 'Success' when input is 'Nothing', and wrapped around the default value.
586
586
587
- @vald \`withDefault\` deflt = 'Data.Maybe.fromMaybe' deflt <$> 'optionally' vald@
587
+ @vald \`withDefault\` deflt = 'Data.Maybe.fromMaybe' deflt ' <$>' 'optionally' vald@
588
588
589
589
==== __Examples__
590
590
591
591
>>> runValidator (failureIf even "Even" `withDefault` 0) (Just 5)
592
- Success (Just 5)
592
+ Success 5
593
593
>>> runValidator (failureIf even "Even" `withDefault` 0) (Just 6)
594
594
Failure ("Even" :| [])
595
595
>>> runValidator (failureIf even "Even" `withDefault` 0) Nothing
596
- Success Nothing
596
+ Success 0
597
597
-}
598
598
withDefault :: Validator e inp a -> a -> Validator e (Maybe inp ) a
599
599
withDefault (Validator v) deflt = Validator $ maybe (Success deflt) v
You can’t perform that action at this time.
0 commit comments