Revision 25779212

b/htools/Ganeti/BasicTypes.hs
36 36
  , compareNameComponent
37 37
  ) where
38 38

  
39
import Control.Applicative
39 40
import Control.Monad
40 41
import Data.Function
41 42
import Data.List
......
68 69
  (Bad _) `mplus` x = x
69 70
  x@(Ok _) `mplus` _ = x
70 71

  
72
instance Applicative Result where
73
  pure = Ok
74
  (Bad f) <*> _       = Bad f
75
  _       <*> (Bad x) = Bad x
76
  (Ok f)  <*> (Ok x)  = Ok $ f x
77

  
71 78
-- | Simple checker for whether a 'Result' is OK.
72 79
isOk :: Result a -> Bool
73 80
isOk (Ok _) = True

Also available in: Unified diff