improve docs

This commit is contained in:
Joey Hess 2015-01-25 01:26:38 -04:00
parent a780cae441
commit f5da1c2b23
1 changed files with 7 additions and 5 deletions

View File

@ -14,7 +14,8 @@ import Propellor.Types
import Propellor.Info import Propellor.Info
import Utility.Monad import Utility.Monad
-- Constructs a Property. -- | Constructs a Property, from a description and an action to run to
-- ensure the Property is met.
property :: Desc -> Propellor Result -> Property NoInfo property :: Desc -> Propellor Result -> Property NoInfo
property d s = simpleProperty d s mempty property d s = simpleProperty d s mempty
@ -38,7 +39,7 @@ flagFile' p getflagfile = adjustPropertySatisfy p $ \satisfy -> do
writeFile flagfile "" writeFile flagfile ""
return r return r
--- | Whenever a change has to be made for a Property, causes a hook -- | Whenever a change has to be made for a Property, causes a hook
-- Property to also be run, but not otherwise. -- Property to also be run, but not otherwise.
onChange onChange
:: (Combines (Property x) (Property y)) :: (Combines (Property x) (Property y))
@ -53,6 +54,7 @@ onChange = combineWith $ \p hook -> do
return $ r <> r' return $ r <> r'
_ -> return r _ -> return r
-- | Alias for @flip describe@
(==>) :: IsProp (Property i) => Desc -> Property i -> Property i (==>) :: IsProp (Property i) => Desc -> Property i -> Property i
(==>) = flip describe (==>) = flip describe
infixl 1 ==> infixl 1 ==>
@ -86,9 +88,6 @@ trivial p = adjustPropertySatisfy p $ \satisfy -> do
then return NoChange then return NoChange
else return r else return r
doNothing :: Property NoInfo
doNothing = property "noop property" noChange
-- | Makes a property that is satisfied differently depending on the host's -- | Makes a property that is satisfied differently depending on the host's
-- operating system. -- operating system.
-- --
@ -106,6 +105,9 @@ makeChange a = liftIO a >> return MadeChange
noChange :: Propellor Result noChange :: Propellor Result
noChange = return NoChange noChange = return NoChange
doNothing :: Property NoInfo
doNothing = property "noop property" noChange
-- | Registers an action that should be run at the very end, -- | Registers an action that should be run at the very end,
endAction :: Desc -> (Result -> Propellor Result) -> Propellor () endAction :: Desc -> (Result -> Propellor Result) -> Propellor ()
endAction desc a = tell [EndAction desc a] endAction desc a = tell [EndAction desc a]