...as it is only included in newer Versions of Data.Either which are not available in all library versions Ganeti has to work on.
Signed-off-by: Klaus Aehlig <[email protected]> --- src/Ganeti/BasicTypes.hs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Ganeti/BasicTypes.hs b/src/Ganeti/BasicTypes.hs index f74b139..b25eb55 100644 --- a/src/Ganeti/BasicTypes.hs +++ b/src/Ganeti/BasicTypes.hs @@ -42,6 +42,7 @@ module Ganeti.BasicTypes , justOk , justBad , eitherToResult + , isLeft , annotateResult , annotateError , failError @@ -274,6 +275,12 @@ eitherToResult :: Either a b -> GenericResult a b eitherToResult (Left s) = Bad s eitherToResult (Right v) = Ok v +-- | Check if an either is Left. Equivalent to isLeft from Data.Either +-- version 4.7.0.0 or higher. +isLeft :: Either a b -> Bool +isLeft (Left _ ) = True +isLeft _ = False + -- | Annotate an error with an ownership information, lifting it to a -- 'MonadError'. Since 'Result' is an instance of 'MonadError' itself, -- it's a generalization of type @String -> Result a -> Result a@. -- 1.9.1.423.g4596e3a
