Agda-2.2.10: A dependently typed functional programming language and proof assistant

Agda.Utils.Either

Description

Utilities for the Either type

Either

Synopsis

isLeft :: Either a b -> BoolSource

Returns True iff the argument is Left x for some x.

True

Left x

Left

x

isRight :: Either a b -> BoolSource

Returns True iff the argument is Right x for some x.

Right x

Right

allRight :: [Either a b] -> Either [Either a b] [b]Source

Returns Right input with tags stripped if all elements are to the right, and otherwise Left input:

Right input with tags stripped

Left input

allRight xs == if all isRight xs then Right (map ((Right x) -> x) xs) else Left xs

tests :: IO BoolSource