ditto 0.1.2.0 → 0.1.3.0
raw patch · 4 files changed
+34/−1 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Ditto.Generalized: withErrors :: Monad m => (view -> [err] -> view) -> Form m input err view a -> Form m input err view a
+ Ditto.Generalized.Named: withErrors :: Monad m => (view -> [err] -> view) -> Form m input err view a -> Form m input err view a
Files
- ditto.cabal +1/−1
- src/Ditto/Generalized.hs +7/−0
- src/Ditto/Generalized/Internal.hs +18/−0
- src/Ditto/Generalized/Named.hs +8/−0
ditto.cabal view
@@ -1,5 +1,5 @@ Name: ditto-Version: 0.1.2.0+Version: 0.1.3.0 Synopsis: ditto is a type-safe HTML form generation and validation library Description: ditto follows in the footsteps of formlets and digestive-functors <= 0.2. It provides a
src/Ditto/Generalized.hs view
@@ -90,3 +90,10 @@ -> Form m input err view () childErrors = G.childErrors +-- | modify the view of a form based on its errors+withErrors+ :: Monad m+ => (view -> [err] -> view)+ -> Form m input err view a+ -> Form m input err view a+withErrors = G.withErrors
src/Ditto/Generalized/Internal.hs view
@@ -469,3 +469,21 @@ } ) )++-- | modify the view of a form based on its errors+withErrors+ :: Monad m+ => (view -> [err] -> view)+ -> Form m input err view a+ -> Form m input err view a+withErrors f form = Form $ do+ (View v, r) <- unForm form+ range <- getFormRange+ pure+ ( View + (\x -> + let errs = retainChildErrors range x+ in f (v x) errs+ )+ , r+ )
src/Ditto/Generalized/Named.hs view
@@ -98,3 +98,11 @@ -> Form m input err view () childErrors = G.childErrors +-- | modify the view of a form based on its errors+withErrors+ :: Monad m+ => (view -> [err] -> view)+ -> Form m input err view a+ -> Form m input err view a+withErrors = G.withErrors+