diff --git a/htools/Ganeti/BasicTypes.hs b/htools/Ganeti/BasicTypes.hs index 55bab28588848679f353d45b50d5fe458657c65d..d68387e9ec435b292d949ff9a78a524fbdea0a03 100644 --- a/htools/Ganeti/BasicTypes.hs +++ b/htools/Ganeti/BasicTypes.hs @@ -56,6 +56,10 @@ instance Monad Result where return = Ok fail = Bad +instance Functor Result where + fmap _ (Bad msg) = Bad msg + fmap fn (Ok val) = Ok (fn val) + instance MonadPlus Result where mzero = Bad "zero Result when used as MonadPlus" -- for mplus, when we 'add' two Bad values, we concatenate their