This will allow us to use the simpler applicative form (<$>, <*>) instead of monadic liftM, liftM2, etc.
Signed-off-by: Iustin Pop <[email protected]> --- htools/Ganeti/BasicTypes.hs | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/htools/Ganeti/BasicTypes.hs b/htools/Ganeti/BasicTypes.hs index 55bab28..d68387e 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 -- 1.7.7.3
