-- 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.1.0


-- | A set of typeclasses <a>Falsifier</a>, <a>Andlike</a>, <a>Orlike</a>,
--   and <a>Xorlike</a>, that define operations dealing with
--   boolean-representable structures such as <a>Maybe</a> which has
--   true-like <a>Just</a> and false-like <a>Nothing</a>, or '[]' by
--   true-like non-empty list and false-like empty list.
module Combinator.Booly

-- | Boolean-like logic operation <a>&gt;&amp;&gt;</a> that acts like AND
--   for any boolean-representable datatypes, e.g. '[]' or <a>Maybe</a>.
--   
--   <b>Associativity</b>
--   
--   <pre>
--   (a &gt;&amp;&gt; b) &gt;&amp;&gt; c == a &gt;&amp;&gt; (b &gt;&amp;&gt; c)
--   </pre>
--   
--   <b>Absorbing element / truth table</b>
--   
--   <pre>
--   false &gt;&amp;&gt; false == false
--   </pre>
--   
--   <pre>
--   false &gt;&amp;&gt; b == false
--   </pre>
--   
--   <pre>
--   a &gt;&amp;&gt; false == false
--   </pre>
--   
--   <pre>
--   a &gt;&amp;&gt; b == b
--   </pre>
class Andlike a where (<&<) = (<*)

-- | Andlike operator, returns the rightmost argument on success, i.e. if
--   no <a>false</a> are present.
(<&<) :: Andlike a => a -> a -> a

-- | Andlike operator, returns the rightmost argument on success, i.e. if
--   no <a>false</a> are present.
(<&<) :: (Andlike a, Applicative f, f b ~ a) => a -> a -> a

-- | Boolean-like logic operation <a>&lt;|&lt;</a> that acts like OR for
--   any boolean-representable datatypes, e.g. '[]' or <a>Maybe</a>. It is
--   basically 'Control.Applicative.(<a>|</a>)' with a list instance that
--   doesn't append.
--   
--   <b>Associativity</b>
--   
--   <pre>
--   (a &lt;|&lt; b) &lt;|&lt; c == a &lt;|&lt; (b &lt;|&lt; c)
--   </pre>
--   
--   <b>Absorbing element / truth table</b>
--   
--   <pre>
--   false &lt;|&lt; false == false
--   </pre>
--   
--   <pre>
--   false &lt;|&lt; b == b
--   </pre>
--   
--   <pre>
--   a &lt;|&lt; false == a
--   </pre>
--   
--   <pre>
--   a &lt;|&lt; b == a
--   </pre>
class Orlike a where (<|<) = (<|>)

-- | Orlike operator, returns the leftmost true-like argument, otherwise
--   the rightmost true-like argument, or finally <a>false</a>.
(<|<) :: Orlike a => a -> a -> a

-- | Orlike operator, returns the leftmost true-like argument, otherwise
--   the rightmost true-like argument, or finally <a>false</a>.
(<|<) :: (Orlike a, Alternative f, f b ~ a) => a -> a -> a

-- | Boolean-like logic operation <a>&lt;^&gt;</a> that acts like XOR for
--   any boolean-representable datatypes, e.g. '[]' or <a>Maybe</a>.
--   
--   <b>Absorbing element / truth table</b>
--   
--   <pre>
--   false &lt;^&gt; false == false
--   </pre>
--   
--   <pre>
--   false &lt;^&gt; b == b
--   </pre>
--   
--   <pre>
--   a &lt;^&gt; false == a
--   </pre>
--   
--   <pre>
--   a &lt;^&gt; b == false
--   </pre>
class Xorlike a

-- | Xorlike operator, returns whichever argument is true-like as both
--   cannot simultaneously be true-like values, or <a>false</a>.
(<^>) :: Xorlike a => a -> a -> a
class Falsifier a where false = mempty
false :: Falsifier a => a
false :: (Falsifier a, Monoid a) => a

-- | Flipped version of <a>&lt;&amp;&lt;</a>. Returns the leftmost argument
--   on both success or failure.
(>&>) :: Andlike a => a -> a -> a
infixr 7 >&>

-- | Flipped version of <a>&lt;|&lt;</a>. 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 <a>bool</a>.
boolF :: (Eq b, Falsifier b) => a -> a -> b -> a

-- | Discard the argument and return <a>false</a>.
voidF :: Falsifier a => a -> a

-- | Similar to <tt>when</tt> but takes a boolean-like and returns
--   <a>false</a> instead of `()`.
whenF :: (Eq a, Eq b, Falsifier a, Falsifier b) => a -> b -> b

-- | Similar to <tt>unless</tt> but takes a boolean-like and returns
--   <a>false</a> 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)
