Revision b1c772fd

b/src/Ganeti/BasicTypes.hs
32 32
  , isBad
33 33
  , eitherToResult
34 34
  , annotateResult
35
  , iterateOk
35 36
  , select
36 37
  , LookupResult(..)
37 38
  , MatchPriority(..)
......
138 139
annotateResult owner (Bad s) = Bad $ owner ++ ": " ++ s
139 140
annotateResult _ v = v
140 141

  
142
-- | Iterate while Ok.
143
iterateOk :: (a -> GenericResult b a) -> a -> [a]
144
iterateOk f a = genericResult (const []) ((:) a . iterateOk f) (f a)
145

  
141 146
-- * Misc functionality
142 147

  
143 148
-- | Return the first result with a True condition, or the default otherwise.

Also available in: Unified diff