On Sat, Mar 28, 2009 at 00:40:43 +0100, Reinier Lamers wrote: > Sat Mar 28 00:15:07 CET 2009 Reinier Lamers <[email protected]> > * Add comments in Darcs.Patch.Check > > Sat Mar 28 00:16:02 CET 2009 Reinier Lamers <[email protected]> > * Refactor PatchCheck monad to be defined with Control.Monad.State.State
Looks good to me. Applied, thanks! Add comments in Darcs.Patch.Check --------------------------------- :-) With David's warnings about the dangers of code comments being a liability, I hope that our push for more haddocks is a good thing. I still think it does, if we think of it as API-writing. Not trying to say what the functions do, but what they're for, and what gotchas to look out for. By the way, perhaps the comment for is_valid to be refactored to remove the double-negative? (is not inconsistent => is consistent?) Refactor PatchCheck monad to be defined with Control.Monad.State.State ---------------------------------------------------------------------- > +-- | Returns a given value if the repository state is inconsistent, and > performs > +-- a given action otherwise. > +handle_inconsistent :: a -- ^ The value to return if the state is > inconsistent > + -> PatchCheck a -- ^ The action to perform otherwise > + -> PatchCheck a > +handle_inconsistent v a = do state <- get > + case state of > + Inconsistent -> return v > + _ -> a This patch has two refactors in one, one which redefines the PatchCheck monad in terms of Control.Monad.State.State (which seems eminently sensible), and also one on the frequently occurring actions that pattern match on the KnownState value returned by the last action. I suspect these could have been done separately, but I could be wrong and it's not a big deal at all. > hunk ./src/Darcs/Patch/Check.hs 146 > -file_empty :: String -> PatchCheck Bool > +-- | Checks if a file is empty > +file_empty :: String -- ^ Name of the file to check Should this be FilePath? -- Eric Kow <http://www.nltg.brighton.ac.uk/home/Eric.Kow> PGP Key ID: 08AC04F9
signature.asc
Description: Digital signature
_______________________________________________ darcs-users mailing list [email protected] http://lists.osuosl.org/mailman/listinfo/darcs-users
