Permalink
Browse files

Slighty less obfuscated names.

  • Loading branch information...
1 parent 44b400b commit b9a2ee6a90e6270a667e52a22dd73b27edb36365 Chris Eidhof committed Aug 30, 2009
Showing with 8 additions and 8 deletions.
  1. +8 −8 Text/Formlets.hs
View
16 Text/Formlets.hs
@@ -120,14 +120,14 @@ checkM (Form frm) f = Form $ \env -> checker f (frm env)
--return x
transform :: Monad m => (a -> m (Failing b)) -> m (Validator a) -> FormState -> m (Validator b)
- transform f source st = x' (x f) source
- where x :: Monad m => (a -> m (Failing b)) -> a -> m (Validator b)
- x f = fmap (liftM (return . FR.fromE)) f
- x' :: Monad m => (a -> m (Validator b)) -> m (Validator a) -> m (Validator b)
- x' f a = do a' <- a
- let (a'', st') = runState a' st
- val <- combine f a''
- return (changeState st' val)
+ transform f source st = transform' (makeValidator f) source
+ where makeValidator :: Monad m => (a -> m (Failing b)) -> a -> m (Validator b)
+ makeValidator f = fmap (liftM (return . FR.fromE)) f
+ transform' :: Monad m => (a -> m (Validator b)) -> m (Validator a) -> m (Validator b)
+ transform' f a = do a' <- a
+ let (a'', st') = runState a' st
+ val <- combine f a''
+ return (changeState st' val)
changeState :: st -> State st a -> State st a
changeState st' mComp = do result <- mComp
put st'

0 comments on commit b9a2ee6

Please sign in to comment.