-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Logical combinatory operations dealing with datatypes -- representing booleans by their constructors. -- -- Boolean-like logical combinatory operations under typeclasses Andlike, -- Orlike, and Xorlike and a typeclass Falsifier for datatypes with unary -- false-like values (e.g. Nothing, []). @package boolean-like @version 0.1.0.0 -- | A set of typeclasses Falsifier, Andlike, Orlike, -- and Xorlike, that define operations dealing with -- boolean-representable structures such as Maybe which has -- true-like Just and false-like Nothing, or '[]' by -- true-like non-empty list and false-like empty list. module Combinator.Booly -- | Boolean-like logic operation >&> that acts like AND -- for any boolean-representable datatypes, e.g. '[]' or Maybe. -- -- Associativity -- --
-- (a >&> b) >&> c == a >&> (b >&> c) ---- -- Absorbing element / truth table -- --
-- false >&> false == false ---- --
-- false >&> b == false ---- --
-- a >&> false == false ---- --
-- a >&> b == b --class Andlike a where (<&<) = (<*) -- | Andlike operator, returns the rightmost argument on success, i.e. if -- no false are present. (<&<) :: Andlike a => a -> a -> a -- | Andlike operator, returns the rightmost argument on success, i.e. if -- no false are present. (<&<) :: (Andlike a, Applicative f, f b ~ a) => a -> a -> a -- | Boolean-like logic operation <|< that acts like OR for -- any boolean-representable datatypes, e.g. '[]' or Maybe. It is -- basically 'Control.Applicative.(|)' with a list instance that -- doesn't append. -- -- Associativity -- --
-- (a <|< b) <|< c == a <|< (b <|< c) ---- -- Absorbing element / truth table -- --
-- false <|< false == false ---- --
-- false <|< b == b ---- --
-- a <|< false == a ---- --
-- a <|< b == a --class Orlike a where (<|<) = (<|>) -- | Orlike operator, returns the leftmost true-like argument, otherwise -- the rightmost true-like argument, or finally false. (<|<) :: Orlike a => a -> a -> a -- | Orlike operator, returns the leftmost true-like argument, otherwise -- the rightmost true-like argument, or finally false. (<|<) :: (Orlike a, Alternative f, f b ~ a) => a -> a -> a -- | Boolean-like logic operation <^> that acts like XOR for -- any boolean-representable datatypes, e.g. '[]' or Maybe. -- -- Absorbing element / truth table -- --
-- false <^> false == false ---- --
-- false <^> b == b ---- --
-- a <^> false == a ---- --
-- a <^> b == false --class Xorlike a -- | Xorlike operator, returns whichever argument is true-like as both -- cannot simultaneously be true-like values, or false. (<^>) :: Xorlike a => a -> a -> a class Falsifier a where false = mempty false :: Falsifier a => a false :: (Falsifier a, Monoid a) => a -- | Flipped version of <&<. Returns the leftmost argument -- on both success or failure. (>&>) :: Andlike a => a -> a -> a infixr 7 >&> -- | Flipped version of <|<. Returns the leftmost argument on -- both success or failure. (>|>) :: Orlike a => a -> a -> a infixr 5 >|> -- | Returns the last element on success of all values. andLast :: (Andlike a, Falsifier a, Foldable t) => t a -> a -- | Returns the first element on success of all values. andHead :: (Andlike a, Falsifier a, Foldable t) => t a -> a -- | Monadic append with the annihilating operator guarding each argument. -- Returns the mappended result on success. andMappend :: (Andlike a, Monoid a) => a -> a -> a -- | Monadic concatenation with the annihilating operator guarding each -- argument. andMconcat :: (Andlike a, Falsifier a, Monoid a, Foldable t) => t a -> a isFalse :: (Eq a, Falsifier a) => a -> Bool isTrue :: (Eq a, Falsifier a) => a -> Bool -- | Similar to bool. boolF :: (Eq b, Falsifier b) => a -> a -> b -> a -- | Discard the argument and return false. voidF :: Falsifier a => a -> a -- | Similar to when but takes a boolean-like and returns -- false instead of `()`. whenF :: (Eq a, Eq b, Falsifier a, Falsifier b) => a -> b -> b -- | Similar to unless but takes a boolean-like and returns -- false instead of `()`. unlessF :: (Eq a, Eq b, Falsifier a, Falsifier b) => a -> b -> b instance Combinator.Booly.Andlike () instance Combinator.Booly.Orlike () instance Combinator.Booly.Xorlike () instance Combinator.Booly.Falsifier () instance Combinator.Booly.Andlike GHC.Types.Bool instance Combinator.Booly.Orlike GHC.Types.Bool instance Combinator.Booly.Xorlike GHC.Types.Bool instance Combinator.Booly.Falsifier GHC.Types.Bool instance Combinator.Booly.Andlike (GHC.Base.Maybe a) instance Combinator.Booly.Orlike (GHC.Base.Maybe a) instance Combinator.Booly.Xorlike (GHC.Base.Maybe a) instance Combinator.Booly.Falsifier (GHC.Base.Maybe a) instance Combinator.Booly.Andlike (Data.Semigroup.Option a) instance Combinator.Booly.Orlike (Data.Semigroup.Option a) instance Combinator.Booly.Xorlike (Data.Semigroup.Option a) instance Combinator.Booly.Falsifier (Data.Semigroup.Option a) instance Combinator.Booly.Andlike (Data.Either.Either a b) instance Combinator.Booly.Orlike (Data.Either.Either a b) instance Combinator.Booly.Andlike [a] instance Combinator.Booly.Orlike [a] instance Combinator.Booly.Xorlike [a] instance Combinator.Booly.Falsifier [a] instance Combinator.Booly.Andlike Data.Text.Internal.Text instance Combinator.Booly.Orlike Data.Text.Internal.Text instance Combinator.Booly.Xorlike Data.Text.Internal.Text instance Combinator.Booly.Falsifier Data.Text.Internal.Text instance Combinator.Booly.Andlike Data.ByteString.Internal.ByteString instance Combinator.Booly.Andlike Data.ByteString.Lazy.Internal.ByteString instance Combinator.Booly.Orlike Data.ByteString.Internal.ByteString instance Combinator.Booly.Orlike Data.ByteString.Lazy.Internal.ByteString instance Combinator.Booly.Xorlike Data.ByteString.Internal.ByteString instance Combinator.Booly.Xorlike Data.ByteString.Lazy.Internal.ByteString instance Combinator.Booly.Falsifier Data.ByteString.Internal.ByteString instance Combinator.Booly.Falsifier Data.ByteString.Lazy.Internal.ByteString instance GHC.Classes.Ord k => Combinator.Booly.Andlike (Data.Map.Base.Map k v) instance GHC.Classes.Ord k => Combinator.Booly.Orlike (Data.Map.Base.Map k v) instance GHC.Classes.Ord k => Combinator.Booly.Xorlike (Data.Map.Base.Map k v) instance GHC.Classes.Ord k => Combinator.Booly.Falsifier (Data.Map.Base.Map k v) instance Combinator.Booly.Andlike (Data.Vector.Vector a) instance Combinator.Booly.Orlike (Data.Vector.Vector a) instance Combinator.Booly.Xorlike (Data.Vector.Vector a) instance Combinator.Booly.Falsifier (Data.Vector.Vector a) instance Combinator.Booly.Andlike (Data.Attoparsec.Internal.Types.Parser i a) instance Combinator.Booly.Orlike (Data.Attoparsec.Internal.Types.Parser i a) instance Combinator.Booly.Falsifier (Data.Attoparsec.Internal.Types.Parser i a) instance (Combinator.Booly.Andlike a, Combinator.Booly.Andlike b) => Combinator.Booly.Andlike (a, b) instance (Combinator.Booly.Orlike a, Combinator.Booly.Orlike b) => Combinator.Booly.Orlike (a, b) instance (Combinator.Booly.Andlike a, Combinator.Booly.Andlike b, Combinator.Booly.Andlike c) => Combinator.Booly.Andlike (a, b, c) instance (Combinator.Booly.Orlike a, Combinator.Booly.Orlike b, Combinator.Booly.Orlike c) => Combinator.Booly.Orlike (a, b, c) instance (Combinator.Booly.Andlike a, Combinator.Booly.Andlike b, Combinator.Booly.Andlike c, Combinator.Booly.Andlike d) => Combinator.Booly.Andlike (a, b, c, d) instance (Combinator.Booly.Orlike a, Combinator.Booly.Orlike b, Combinator.Booly.Orlike c, Combinator.Booly.Orlike d) => Combinator.Booly.Orlike (a, b, c, d)