planet-mitchell-0.1.0: Planet Mitchell

Safe HaskellSafe
LanguageHaskell2010

Bool

Contents

Synopsis

Boolean

data Bool #

Constructors

False 
True 
Instances
Bounded Bool

Since: base-2.1

Instance details

Defined in GHC.Enum

Enum Bool

Since: base-2.1

Instance details

Defined in GHC.Enum

Methods

succ :: Bool -> Bool #

pred :: Bool -> Bool #

toEnum :: Int -> Bool #

fromEnum :: Bool -> Int #

enumFrom :: Bool -> [Bool] #

enumFromThen :: Bool -> Bool -> [Bool] #

enumFromTo :: Bool -> Bool -> [Bool] #

enumFromThenTo :: Bool -> Bool -> Bool -> [Bool] #

Eq Bool 
Instance details

Defined in GHC.Classes

Methods

(==) :: Bool -> Bool -> Bool #

(/=) :: Bool -> Bool -> Bool #

Data Bool

Since: base-4.0.0.0

Instance details

Defined in Data.Data

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Bool -> c Bool #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Bool #

toConstr :: Bool -> Constr #

dataTypeOf :: Bool -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Bool) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Bool) #

gmapT :: (forall b. Data b => b -> b) -> Bool -> Bool #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Bool -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Bool -> r #

gmapQ :: (forall d. Data d => d -> u) -> Bool -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Bool -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Bool -> m Bool #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Bool -> m Bool #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Bool -> m Bool #

Ord Bool 
Instance details

Defined in GHC.Classes

Methods

compare :: Bool -> Bool -> Ordering #

(<) :: Bool -> Bool -> Bool #

(<=) :: Bool -> Bool -> Bool #

(>) :: Bool -> Bool -> Bool #

(>=) :: Bool -> Bool -> Bool #

max :: Bool -> Bool -> Bool #

min :: Bool -> Bool -> Bool #

Read Bool

Since: base-2.1

Instance details

Defined in GHC.Read

Show Bool 
Instance details

Defined in GHC.Show

Methods

showsPrec :: Int -> Bool -> ShowS #

show :: Bool -> String #

showList :: [Bool] -> ShowS #

Ix Bool

Since: base-2.1

Instance details

Defined in GHC.Arr

Methods

range :: (Bool, Bool) -> [Bool] #

index :: (Bool, Bool) -> Bool -> Int #

unsafeIndex :: (Bool, Bool) -> Bool -> Int

inRange :: (Bool, Bool) -> Bool -> Bool #

rangeSize :: (Bool, Bool) -> Int #

unsafeRangeSize :: (Bool, Bool) -> Int

Generic Bool 
Instance details

Defined in GHC.Generics

Associated Types

type Rep Bool :: * -> * #

Methods

from :: Bool -> Rep Bool x #

to :: Rep Bool x -> Bool #

Lift Bool 
Instance details

Defined in Language.Haskell.TH.Syntax

Methods

lift :: Bool -> Q Exp #

Hashable Bool 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Bool -> Int #

hash :: Bool -> Int #

ToJSON Bool 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSONKey Bool 
Instance details

Defined in Data.Aeson.Types.ToJSON

FromJSON Bool 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSONKey Bool 
Instance details

Defined in Data.Aeson.Types.FromJSON

SingKind Bool

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Associated Types

type DemoteRep Bool :: *

Methods

fromSing :: Sing a -> DemoteRep Bool

Storable Bool

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: Bool -> Int #

alignment :: Bool -> Int #

peekElemOff :: Ptr Bool -> Int -> IO Bool #

pokeElemOff :: Ptr Bool -> Int -> Bool -> IO () #

peekByteOff :: Ptr b -> Int -> IO Bool #

pokeByteOff :: Ptr b -> Int -> Bool -> IO () #

peek :: Ptr Bool -> IO Bool #

poke :: Ptr Bool -> Bool -> IO () #

Bits Bool

Interpret Bool as 1-bit bit-field

Since: base-4.7.0.0

Instance details

Defined in Data.Bits

FiniteBits Bool

Since: base-4.7.0.0

Instance details

Defined in Data.Bits

NFData Bool 
Instance details

Defined in Control.DeepSeq

Methods

rnf :: Bool -> () #

Unbox Bool 
Instance details

Defined in Data.Vector.Unboxed.Base

Variate Bool 
Instance details

Defined in System.Random.MWC

Methods

uniform :: PrimMonad m => Gen (PrimState m) -> m Bool #

uniformR :: PrimMonad m => (Bool, Bool) -> Gen (PrimState m) -> m Bool #

Pretty Bool
>>> pretty True
True
Instance details

Defined in Data.Text.Prettyprint.Doc.Internal

Methods

pretty :: Bool -> Doc ann #

prettyList :: [Bool] -> Doc ann #

Meet Bool

Boolean conjunction forms a semilattice.

Idempotence:

x /\ x == (x :: Bool)

Associativity:

a /\ (b /\ c) == (a /\ b) /\ (c :: Bool)

Commutativity:

a /\ b == b /\ (a :: Bool)

Identity:

upperBound /\ a == (a :: Bool)

Absorption:

lowerBound /\ a == (lowerBound :: Bool)
Instance details

Defined in Data.Semilattice.Meet

Methods

(/\) :: Bool -> Bool -> Bool #

Upper Bool 
Instance details

Defined in Data.Semilattice.Upper

Methods

upperBound :: Bool #

Join Bool

Boolean disjunction forms a semilattice.

Idempotence:

x \/ x == (x :: Bool)

Associativity:

a \/ (b \/ c) == (a \/ b) \/ (c :: Bool)

Commutativity:

a \/ b == b \/ (a :: Bool)

Identity:

lowerBound \/ a == (a :: Bool)

Absorption:

upperBound \/ a == (upperBound :: Bool)
Instance details

Defined in Data.Semilattice.Join

Methods

(\/) :: Bool -> Bool -> Bool #

Lower Bool 
Instance details

Defined in Data.Semilattice.Lower

Methods

lowerBound :: Bool #

Serialise Bool

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

SingI False

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Methods

sing :: Sing False

SingI True

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Methods

sing :: Sing True

Vector Vector Bool 
Instance details

Defined in Data.Vector.Unboxed.Base

HasTypes Bool a 
Instance details

Defined in Data.Generics.Product.Types

Methods

types_ :: Traversal' Bool a

MVector MVector Bool 
Instance details

Defined in Data.Vector.Unboxed.Base

() :=> (Bounded Bool) 
Instance details

Defined in Data.Constraint

Methods

ins :: () :- Bounded Bool #

() :=> (Enum Bool) 
Instance details

Defined in Data.Constraint

Methods

ins :: () :- Enum Bool #

() :=> (Eq Bool) 
Instance details

Defined in Data.Constraint

Methods

ins :: () :- Eq Bool #

() :=> (Ord Bool) 
Instance details

Defined in Data.Constraint

Methods

ins :: () :- Ord Bool #

() :=> (Read Bool) 
Instance details

Defined in Data.Constraint

Methods

ins :: () :- Read Bool #

() :=> (Show Bool) 
Instance details

Defined in Data.Constraint

Methods

ins :: () :- Show Bool #

() :=> (Bits Bool) 
Instance details

Defined in Data.Constraint

Methods

ins :: () :- Bits Bool #

type Rep Bool 
Instance details

Defined in GHC.Generics

type Rep Bool = D1 (MetaData "Bool" "GHC.Types" "ghc-prim" False) (C1 (MetaCons "False" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "True" PrefixI False) (U1 :: * -> *))
data Sing (a :: Bool) 
Instance details

Defined in GHC.Generics

data Sing (a :: Bool) where
type DemoteRep Bool 
Instance details

Defined in GHC.Generics

type DemoteRep Bool = Bool
data Vector Bool 
Instance details

Defined in Data.Vector.Unboxed.Base

data MVector s Bool 
Instance details

Defined in Data.Vector.Unboxed.Base

type Eval (HasTotalFieldPSym sym :: (Type -> Type) -> Bool -> Type) (tt :: Type -> Type) 
Instance details

Defined in Data.Generics.Product.Internal.Subtype

type Eval (HasTotalFieldPSym sym :: (Type -> Type) -> Bool -> Type) (tt :: Type -> Type) = HasTotalFieldP sym tt
type Eval (HasTotalFieldPSym sym :: (Type -> Type) -> Bool -> Type) (tt :: Type -> Type) 
Instance details

Defined in Data.Generics.Product.Fields

type Eval (HasTotalFieldPSym sym :: (Type -> Type) -> Bool -> Type) (tt :: Type -> Type) = HasTotalFieldP sym tt
type Eval (HasTotalPositionPSym t :: (Type -> Type) -> Bool -> Type) (tt :: Type -> Type) 
Instance details

Defined in Data.Generics.Product.Positions

type Eval (HasTotalPositionPSym t :: (Type -> Type) -> Bool -> Type) (tt :: Type -> Type) = HasTotalPositionP t tt
type Eval (HasTotalTypePSym t :: (Type -> Type) -> Bool -> Type) (tt :: Type -> Type) 
Instance details

Defined in Data.Generics.Product.Typed

type Eval (HasTotalTypePSym t :: (Type -> Type) -> Bool -> Type) (tt :: Type -> Type) = HasTotalTypeP t tt

(&&) :: Bool -> Bool -> Bool infixr 3 #

Boolean "and"

(||) :: Bool -> Bool -> Bool infixr 2 #

Boolean "or"

not :: Bool -> Bool #

Boolean "not"

otherwise :: Bool #

otherwise is defined as the value True. It helps to make guards more readable. eg.

 f x | x < 0     = ...
     | otherwise = ...

bool :: a -> a -> Bool -> a #

Case analysis for the Bool type. bool x y p evaluates to x when p is False, and evaluates to y when p is True.

This is equivalent to if p then y else x; that is, one can think of it as an if-then-else construct with its arguments reordered.

Examples

Expand

Basic usage:

>>> bool "foo" "bar" True
"bar"
>>> bool "foo" "bar" False
"foo"

Confirm that bool x y p and if p then y else x are equivalent:

>>> let p = True; x = "bar"; y = "foo"
>>> bool x y p == if p then y else x
True
>>> let p = False
>>> bool x y p == if p then y else x
True

Since: base-4.7.0.0

Newtypes

newtype All #

Boolean monoid under conjunction (&&).

>>> getAll (All True <> mempty <> All False)
False
>>> getAll (mconcat (map (\x -> All (even x)) [2,4,6,7,8]))
False

Constructors

All 

Fields

Instances
Bounded All 
Instance details

Defined in Data.Semigroup.Internal

Methods

minBound :: All #

maxBound :: All #

Eq All 
Instance details

Defined in Data.Semigroup.Internal

Methods

(==) :: All -> All -> Bool #

(/=) :: All -> All -> Bool #

Data All

Since: base-4.8.0.0

Instance details

Defined in Data.Data

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> All -> c All #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c All #

toConstr :: All -> Constr #

dataTypeOf :: All -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c All) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c All) #

gmapT :: (forall b. Data b => b -> b) -> All -> All #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> All -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> All -> r #

gmapQ :: (forall d. Data d => d -> u) -> All -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> All -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> All -> m All #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> All -> m All #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> All -> m All #

Ord All 
Instance details

Defined in Data.Semigroup.Internal

Methods

compare :: All -> All -> Ordering #

(<) :: All -> All -> Bool #

(<=) :: All -> All -> Bool #

(>) :: All -> All -> Bool #

(>=) :: All -> All -> Bool #

max :: All -> All -> All #

min :: All -> All -> All #

Read All 
Instance details

Defined in Data.Semigroup.Internal

Show All 
Instance details

Defined in Data.Semigroup.Internal

Methods

showsPrec :: Int -> All -> ShowS #

show :: All -> String #

showList :: [All] -> ShowS #

Generic All 
Instance details

Defined in Data.Semigroup.Internal

Associated Types

type Rep All :: * -> * #

Methods

from :: All -> Rep All x #

to :: Rep All x -> All #

Semigroup All

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup.Internal

Methods

(<>) :: All -> All -> All #

sconcat :: NonEmpty All -> All #

stimes :: Integral b => b -> All -> All #

Monoid All

Since: base-2.1

Instance details

Defined in Data.Semigroup.Internal

Methods

mempty :: All #

mappend :: All -> All -> All #

mconcat :: [All] -> All #

NFData All

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: All -> () #

Wrapped All 
Instance details

Defined in Control.Lens.Wrapped

Associated Types

type Unwrapped All :: * #

AsEmpty All 
Instance details

Defined in Control.Lens.Empty

Methods

_Empty :: Prism' All () #

Upper All 
Instance details

Defined in Data.Semilattice.Upper

Methods

upperBound :: All #

Lower All 
Instance details

Defined in Data.Semilattice.Lower

Methods

lowerBound :: All #

Serialise All

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

t ~ All => Rewrapped All t 
Instance details

Defined in Control.Lens.Wrapped

type Rep All 
Instance details

Defined in Data.Semigroup.Internal

type Rep All = D1 (MetaData "All" "Data.Semigroup.Internal" "base" True) (C1 (MetaCons "All" PrefixI True) (S1 (MetaSel (Just "getAll") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool)))
type Unwrapped All 
Instance details

Defined in Control.Lens.Wrapped

newtype Any #

Boolean monoid under disjunction (||).

>>> getAny (Any True <> mempty <> Any False)
True
>>> getAny (mconcat (map (\x -> Any (even x)) [2,4,6,7,8]))
True

Constructors

Any 

Fields

Instances
Bounded Any 
Instance details

Defined in Data.Semigroup.Internal

Methods

minBound :: Any #

maxBound :: Any #

Eq Any 
Instance details

Defined in Data.Semigroup.Internal

Methods

(==) :: Any -> Any -> Bool #

(/=) :: Any -> Any -> Bool #

Data Any

Since: base-4.8.0.0

Instance details

Defined in Data.Data

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Any -> c Any #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Any #

toConstr :: Any -> Constr #

dataTypeOf :: Any -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Any) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Any) #

gmapT :: (forall b. Data b => b -> b) -> Any -> Any #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Any -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Any -> r #

gmapQ :: (forall d. Data d => d -> u) -> Any -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Any -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Any -> m Any #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Any -> m Any #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Any -> m Any #

Ord Any 
Instance details

Defined in Data.Semigroup.Internal

Methods

compare :: Any -> Any -> Ordering #

(<) :: Any -> Any -> Bool #

(<=) :: Any -> Any -> Bool #

(>) :: Any -> Any -> Bool #

(>=) :: Any -> Any -> Bool #

max :: Any -> Any -> Any #

min :: Any -> Any -> Any #

Read Any 
Instance details

Defined in Data.Semigroup.Internal

Show Any 
Instance details

Defined in Data.Semigroup.Internal

Methods

showsPrec :: Int -> Any -> ShowS #

show :: Any -> String #

showList :: [Any] -> ShowS #

Generic Any 
Instance details

Defined in Data.Semigroup.Internal

Associated Types

type Rep Any :: * -> * #

Methods

from :: Any -> Rep Any x #

to :: Rep Any x -> Any #

Semigroup Any

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup.Internal

Methods

(<>) :: Any -> Any -> Any #

sconcat :: NonEmpty Any -> Any #

stimes :: Integral b => b -> Any -> Any #

Monoid Any

Since: base-2.1

Instance details

Defined in Data.Semigroup.Internal

Methods

mempty :: Any #

mappend :: Any -> Any -> Any #

mconcat :: [Any] -> Any #

NFData Any

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: Any -> () #

Wrapped Any 
Instance details

Defined in Control.Lens.Wrapped

Associated Types

type Unwrapped Any :: * #

AsEmpty Any 
Instance details

Defined in Control.Lens.Empty

Methods

_Empty :: Prism' Any () #

Upper Any 
Instance details

Defined in Data.Semilattice.Upper

Methods

upperBound :: Any #

Lower Any 
Instance details

Defined in Data.Semilattice.Lower

Methods

lowerBound :: Any #

Serialise Any

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

t ~ Any => Rewrapped Any t 
Instance details

Defined in Control.Lens.Wrapped

type Rep Any 
Instance details

Defined in Data.Semigroup.Internal

type Rep Any = D1 (MetaData "Any" "Data.Semigroup.Internal" "base" True) (C1 (MetaCons "Any" PrefixI True) (S1 (MetaSel (Just "getAny") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool)))
type Unwrapped Any 
Instance details

Defined in Control.Lens.Wrapped

Boolean type functions

type family If (cond :: Bool) (tru :: k) (fls :: k) :: k where ... #

Type-level If. If True a b ==> a; If False a b ==> b

Equations

If True (tru :: k) (fls :: k) = tru 
If False (tru :: k) (fls :: k) = fls 

type family (a :: Bool) && (b :: Bool) :: Bool where ... infixr 3 #

Type-level "and"

Equations

False && a = False 
True && a = a 
a && False = False 
a && True = a 
a && a = a 

type family (a :: Bool) || (b :: Bool) :: Bool where ... infixr 2 #

Type-level "or"

Equations

False || a = a 
True || a = True 
a || False = a 
a || True = True 
a || a = a 

type family Not (a :: Bool) = (res :: Bool) | res -> a where ... #

Type-level "not". An injective type family since 4.10.0.0.

Since: base-4.7.0.0

Equations

Not False = True 
Not True = False