Revision 78209a84

b/src/Ganeti/BasicTypes.hs
112 112
  _       <*> (Bad x) = Bad x
113 113
  (Ok f)  <*> (Ok x)  = Ok $ f x
114 114

  
115
instance (FromString a, Monoid a) => Alternative (GenericResult a) where
116
  empty = mzero
117
  (<|>) = mplus
118

  
115 119
-- | This is a monad transformation for Result. It's implementation is
116 120
-- based on the implementations of MaybeT and ErrorT.
117 121
newtype ResultT a m b = ResultT {runResultT :: m (GenericResult a b)}
......
157 161
  mplus x y = elimResultT combine return x
158 162
    where combine x' = ResultT $ liftM (mplus (Bad x')) (runResultT y)
159 163

  
164
instance (Monad m, FromString a, Monoid a) => Alternative (ResultT a m) where
165
  empty = mzero
166
  (<|>) = mplus
167

  
160 168
-- | Lift a `Result` value to a `ResultT`.
161 169
resultT :: Monad m => GenericResult a b -> ResultT a m b
162 170
resultT = ResultT . return

Also available in: Unified diff