| Safe Haskell | Safe |
|---|---|
| Language | Haskell2010 |
Bool
Synopsis
- data Bool
- (&&) :: Bool -> Bool -> Bool
- (||) :: Bool -> Bool -> Bool
- not :: Bool -> Bool
- otherwise :: Bool
- bool :: a -> a -> Bool -> a
- newtype All = All {}
- newtype Any = Any {}
- type family If (cond :: Bool) (tru :: k) (fls :: k) :: k where ...
- type family (a :: Bool) && (b :: Bool) :: Bool where ...
- type family (a :: Bool) || (b :: Bool) :: Bool where ...
- type family Not (a :: Bool) = (res :: Bool) | res -> a where ...
Boolean
Instances
| Bounded Bool | Since: base-2.1 |
| Enum Bool | Since: base-2.1 |
| Eq Bool | |
| Data Bool | Since: base-4.0.0.0 |
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 # 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 | |
| Read Bool | Since: base-2.1 |
| Show Bool | |
| Ix Bool | Since: base-2.1 |
| Generic Bool | |
| Lift Bool | |
| Hashable Bool | |
Defined in Data.Hashable.Class | |
| ToJSON Bool | |
Defined in Data.Aeson.Types.ToJSON | |
| ToJSONKey Bool | |
Defined in Data.Aeson.Types.ToJSON | |
| FromJSON Bool | |
| FromJSONKey Bool | |
Defined in Data.Aeson.Types.FromJSON | |
| SingKind Bool | Since: base-4.9.0.0 |
Defined in GHC.Generics | |
| Storable Bool | Since: base-2.1 |
Defined in Foreign.Storable | |
| Bits Bool | Interpret Since: base-4.7.0.0 |
Defined in Data.Bits Methods (.&.) :: Bool -> Bool -> Bool # (.|.) :: Bool -> Bool -> Bool # complement :: Bool -> Bool # shift :: Bool -> Int -> Bool # rotate :: Bool -> Int -> Bool # setBit :: Bool -> Int -> Bool # clearBit :: Bool -> Int -> Bool # complementBit :: Bool -> Int -> Bool # testBit :: Bool -> Int -> Bool # bitSizeMaybe :: Bool -> Maybe Int # shiftL :: Bool -> Int -> Bool # unsafeShiftL :: Bool -> Int -> Bool # shiftR :: Bool -> Int -> Bool # unsafeShiftR :: Bool -> Int -> Bool # rotateL :: Bool -> Int -> Bool # | |
| FiniteBits Bool | Since: base-4.7.0.0 |
Defined in Data.Bits Methods finiteBitSize :: Bool -> Int # countLeadingZeros :: Bool -> Int # countTrailingZeros :: Bool -> Int # | |
| NFData Bool | |
Defined in Control.DeepSeq | |
| Unbox Bool | |
Defined in Data.Vector.Unboxed.Base | |
| Variate Bool | |
| Pretty Bool |
|
Defined in Data.Text.Prettyprint.Doc.Internal | |
| 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) |
| Upper Bool | |
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) |
| Lower Bool | |
Defined in Data.Semilattice.Lower Methods lowerBound :: Bool # | |
| Serialise Bool | Since: serialise-0.2.0.0 |
| SingI False | Since: base-4.9.0.0 |
Defined in GHC.Generics | |
| SingI True | Since: base-4.9.0.0 |
Defined in GHC.Generics | |
| Vector Vector Bool | |
Defined in Data.Vector.Unboxed.Base Methods basicUnsafeFreeze :: PrimMonad m => Mutable Vector (PrimState m) Bool -> m (Vector Bool) # basicUnsafeThaw :: PrimMonad m => Vector Bool -> m (Mutable Vector (PrimState m) Bool) # basicLength :: Vector Bool -> Int # basicUnsafeSlice :: Int -> Int -> Vector Bool -> Vector Bool # basicUnsafeIndexM :: Monad m => Vector Bool -> Int -> m Bool # basicUnsafeCopy :: PrimMonad m => Mutable Vector (PrimState m) Bool -> Vector Bool -> m () # | |
| HasTypes Bool a | |
Defined in Data.Generics.Product.Types Methods types_ :: Traversal' Bool a | |
| MVector MVector Bool | |
Defined in Data.Vector.Unboxed.Base Methods basicLength :: MVector s Bool -> Int # basicUnsafeSlice :: Int -> Int -> MVector s Bool -> MVector s Bool # basicOverlaps :: MVector s Bool -> MVector s Bool -> Bool # basicUnsafeNew :: PrimMonad m => Int -> m (MVector (PrimState m) Bool) # basicInitialize :: PrimMonad m => MVector (PrimState m) Bool -> m () # basicUnsafeReplicate :: PrimMonad m => Int -> Bool -> m (MVector (PrimState m) Bool) # basicUnsafeRead :: PrimMonad m => MVector (PrimState m) Bool -> Int -> m Bool # basicUnsafeWrite :: PrimMonad m => MVector (PrimState m) Bool -> Int -> Bool -> m () # basicClear :: PrimMonad m => MVector (PrimState m) Bool -> m () # basicSet :: PrimMonad m => MVector (PrimState m) Bool -> Bool -> m () # basicUnsafeCopy :: PrimMonad m => MVector (PrimState m) Bool -> MVector (PrimState m) Bool -> m () # basicUnsafeMove :: PrimMonad m => MVector (PrimState m) Bool -> MVector (PrimState m) Bool -> m () # basicUnsafeGrow :: PrimMonad m => MVector (PrimState m) Bool -> Int -> m (MVector (PrimState m) Bool) # | |
| () :=> (Bounded Bool) | |
| () :=> (Enum Bool) | |
| () :=> (Eq Bool) | |
| () :=> (Ord Bool) | |
| () :=> (Read Bool) | |
| () :=> (Show Bool) | |
| () :=> (Bits Bool) | |
| type Rep Bool | |
| data Sing (a :: Bool) | |
| type DemoteRep Bool | |
Defined in GHC.Generics | |
| data Vector Bool | |
| data MVector s Bool | |
| type Eval (HasTotalFieldPSym sym :: (Type -> Type) -> Bool -> Type) (tt :: Type -> Type) | |
| type Eval (HasTotalFieldPSym sym :: (Type -> Type) -> Bool -> Type) (tt :: Type -> Type) | |
| type Eval (HasTotalPositionPSym t :: (Type -> Type) -> Bool -> Type) (tt :: Type -> Type) | |
| type Eval (HasTotalTypePSym t :: (Type -> Type) -> Bool -> Type) (tt :: Type -> Type) | |
Case analysis for the Bool type. evaluates to bool x y px
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
Basic usage:
>>>bool "foo" "bar" True"bar">>>bool "foo" "bar" False"foo"
Confirm that and bool x y pif p then y else x are
equivalent:
>>>let p = True; x = "bar"; y = "foo">>>bool x y p == if p then y else xTrue>>>let p = False>>>bool x y p == if p then y else xTrue
Since: base-4.7.0.0
Newtypes
Boolean monoid under conjunction (&&).
>>>getAll (All True <> mempty <> All False)False
>>>getAll (mconcat (map (\x -> All (even x)) [2,4,6,7,8]))False
Instances
| Bounded All | |
| Eq All | |
| Data All | Since: base-4.8.0.0 |
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 # 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 | |
| Read All | |
| Show All | |
| Generic All | |
| Semigroup All | Since: base-4.9.0.0 |
| Monoid All | Since: base-2.1 |
| NFData All | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
| Wrapped All | |
| AsEmpty All | |
Defined in Control.Lens.Empty | |
| Upper All | |
Defined in Data.Semilattice.Upper Methods upperBound :: All # | |
| Lower All | |
Defined in Data.Semilattice.Lower Methods lowerBound :: All # | |
| Serialise All | Since: serialise-0.2.0.0 |
| t ~ All => Rewrapped All t | |
Defined in Control.Lens.Wrapped | |
| type Rep All | |
Defined in Data.Semigroup.Internal | |
| type Unwrapped All | |
Defined in Control.Lens.Wrapped | |
Boolean monoid under disjunction (||).
>>>getAny (Any True <> mempty <> Any False)True
>>>getAny (mconcat (map (\x -> Any (even x)) [2,4,6,7,8]))True
Instances
| Bounded Any | |
| Eq Any | |
| Data Any | Since: base-4.8.0.0 |
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 # 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 | |
| Read Any | |
| Show Any | |
| Generic Any | |
| Semigroup Any | Since: base-4.9.0.0 |
| Monoid Any | Since: base-2.1 |
| NFData Any | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
| Wrapped Any | |
| AsEmpty Any | |
Defined in Control.Lens.Empty | |
| Upper Any | |
Defined in Data.Semilattice.Upper Methods upperBound :: Any # | |
| Lower Any | |
Defined in Data.Semilattice.Lower Methods lowerBound :: Any # | |
| Serialise Any | Since: serialise-0.2.0.0 |
| t ~ Any => Rewrapped Any t | |
Defined in Control.Lens.Wrapped | |
| type Rep Any | |
Defined in Data.Semigroup.Internal | |
| type Unwrapped Any | |
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