Revision 9491766c src/Ganeti/BasicTypes.hs

b/src/Ganeti/BasicTypes.hs
30 30
  , FromString(..)
31 31
  , isOk
32 32
  , isBad
33
  , justOk
33 34
  , eitherToResult
34 35
  , annotateResult
35 36
  , iterateOk
......
135 136
isBad :: GenericResult a b -> Bool
136 137
isBad = not . isOk
137 138

  
139
-- | Simple filter returning only OK values of GenericResult
140
justOk :: [GenericResult a b] -> [b]
141
justOk [] = []
142
justOk (x:xs) = case x of
143
  Ok  v -> v:justOk xs
144
  Bad _ -> justOk xs
145

  
138 146
-- | Converter from Either to 'GenericResult'.
139 147
eitherToResult :: Either a b -> GenericResult a b
140 148
eitherToResult (Left  s) = Bad s

Also available in: Unified diff