-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Generalized booleans
--
-- Some classes for generalized boolean operations. Starting with 0.1.0,
-- this package uses type families. Up to version 0.0.2, it used MPTCs
-- with functional dependencies. My thanks to Andy Gill for suggesting
-- & helping with the change. Thanks also to Alex Horsman for the
-- overloading module.
--
-- Copyright 2009-2012 Conal Elliott; BSD3 license.
@package Boolean
@version 0.1.1
-- | Some classes for generalized boolean operations.
--
-- In this design, for if-then-else, equality and inequality tests, the
-- boolean type depends on the value type.
--
-- I also tried using a unary type constructor class. The class doesn't
-- work for regular booleans, so generality is lost. Also, we'd probably
-- have to wire class constraints in like: (==*) :: Eq a => f Bool
-- -> f a -> f a -> f a, which disallows situations needing
-- additional constraints, e.g., Show.
--
-- Starting with 0.1.0, this package uses type families. Up to version
-- 0.0.2, it used MPTCs with functional dependencies. My thanks to Andy
-- Gill for suggesting & helping with the change.
module Data.Boolean
-- | Generalized boolean class
class Boolean b
true, false :: Boolean b => b
notB :: Boolean b => b -> b
(&&*, ||*) :: Boolean b => b -> b -> b
-- | BooleanOf computed the boolean analog of a specific type.
-- | Types with conditionals
class Boolean (BooleanOf a) => IfB a
ifB :: (IfB a, bool ~ BooleanOf a) => bool -> a -> a -> a
-- | Expression-lifted conditional with condition last
boolean :: (IfB a, bool ~ BooleanOf a) => a -> a -> bool -> a
-- | Point-wise conditional
cond :: (Applicative f, IfB a, bool ~ BooleanOf a) => f bool -> f a -> f a -> f a
-- | Generalized cropping, filling in mempty where the test yields
-- false.
crop :: (Applicative f, Monoid (f a), IfB a, bool ~ BooleanOf a) => f bool -> f a -> f a
-- | Types with equality. Minimum definition: '(==*)'.
class Boolean (BooleanOf a) => EqB a where u /=* v = notB (u ==* v)
(==*, /=*) :: (EqB a, bool ~ BooleanOf a) => a -> a -> bool
-- | Types with inequality. Minimum definition: '(<*)'.
class Boolean (BooleanOf a) => OrdB a where u >* v = v <* u u >=* v = notB (u <* v) u <=* v = v >=* u
(<*, >=*, >*, <=*) :: (OrdB a, bool ~ BooleanOf a) => a -> a -> bool
-- | Variant of min using ifB and '(<=*)'
minB :: (IfB a, OrdB a) => a -> a -> a
-- | Variant of max using ifB and '(>=*)'
maxB :: (IfB a, OrdB a) => a -> a -> a
-- | Variant of min and max using ifB and '(<=*)'
sort2B :: (IfB a, OrdB a) => (a, a) -> (a, a)
instance OrdB a => OrdB (z -> a)
instance EqB a => EqB (z -> a)
instance IfB a => IfB (z -> a)
instance Boolean bool => Boolean (z -> bool)
instance (bool ~ BooleanOf p, bool ~ BooleanOf q, bool ~ BooleanOf r, bool ~ BooleanOf s, IfB p, IfB q, IfB r, IfB s) => IfB (p, q, r, s)
instance (bool ~ BooleanOf p, bool ~ BooleanOf q, bool ~ BooleanOf r, IfB p, IfB q, IfB r) => IfB (p, q, r)
instance (bool ~ BooleanOf p, bool ~ BooleanOf q, IfB p, IfB q) => IfB (p, q)
instance (Boolean (BooleanOf a), BooleanOf a ~ Bool) => IfB [a]
instance OrdB Char
instance EqB Char
instance IfB Char
instance OrdB Bool
instance EqB Bool
instance IfB Bool
instance OrdB Double
instance EqB Double
instance IfB Double
instance OrdB Float
instance EqB Float
instance IfB Float
instance OrdB Integer
instance EqB Integer
instance IfB Integer
instance OrdB Int
instance EqB Int
instance IfB Int
instance Boolean Bool
module Data.Boolean.Overload
(&&) :: Boolean a => a -> a -> a
(||) :: Boolean a => a -> a -> a
not :: Boolean a => a -> a
ifThenElse :: IfB a => BooleanOf a -> a -> a -> a
(==) :: EqB a => a -> a -> BooleanOf a
(/=) :: EqB a => a -> a -> BooleanOf a
(<) :: OrdB a => a -> a -> BooleanOf a
(>) :: OrdB a => a -> a -> BooleanOf a
(<=) :: OrdB a => a -> a -> BooleanOf a
(>=) :: OrdB a => a -> a -> BooleanOf a
min :: (IfB a, OrdB a) => a -> a -> a
max :: (IfB a, OrdB a) => a -> a -> a