base-compat-batteries-0.12.1: base-compat with extra batteries

Safe Haskell | Safe-Inferred
Language | Haskell2010

Data.Void.Compat

Synopsis

- data Void
- absurd :: Void -> a
- vacuous :: Functor f => f Void -> f a

# Documentation

data Void #

Uninhabited data type

Since: base-4.8.0.0

#### Instances

Instances details

Eq Void | Since: base-4.8.0.0
Instance details Defined in Data.Void Methods (==) :: Void -> Void -> Bool # (/=) :: Void -> Void -> Bool #
Data Void | Since: base-4.8.0.0
Instance details Defined in Data.Void Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Void -> c Void # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Void # toConstr :: Void -> Constr # dataTypeOf :: Void -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Void) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Void) # gmapT :: (forall b. Data b => b -> b) -> Void -> Void # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Void -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Void -> r # gmapQ :: (forall d. Data d => d -> u) -> Void -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Void -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Void -> m Void # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Void -> m Void # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Void -> m Void #
Ord Void | Since: base-4.8.0.0
Instance details Defined in Data.Void Methods compare :: Void -> Void -> Ordering # (<) :: Void -> Void -> Bool # (<=) :: Void -> Void -> Bool # (>) :: Void -> Void -> Bool # (>=) :: Void -> Void -> Bool # max :: Void -> Void -> Void # min :: Void -> Void -> Void #
Read Void | Reading a `Void` value is always a parse error, considering `Void` as a data type with no constructors. Since: base-4.8.0.0
Instance details Defined in Data.Void Methods readsPrec :: Int -> ReadS Void # readList :: ReadS [Void] # readPrec :: ReadPrec Void # readListPrec :: ReadPrec [Void] #
Show Void | Since: base-4.8.0.0
Instance details Defined in Data.Void Methods showsPrec :: Int -> Void -> ShowS # show :: Void -> String # showList :: [Void] -> ShowS #
Ix Void | Since: base-4.8.0.0
Instance details Defined in Data.Void Methods range :: (Void, Void) -> [Void] # index :: (Void, Void) -> Void -> Int # unsafeIndex :: (Void, Void) -> Void -> Int # inRange :: (Void, Void) -> Void -> Bool # rangeSize :: (Void, Void) -> Int # unsafeRangeSize :: (Void, Void) -> Int #
Generic Void | Since: base-4.8.0.0
Instance details Defined in Data.Void Associated Types type Rep Void :: Type -> Type # Methods from :: Void -> Rep Void x # to :: Rep Void x -> Void #
Semigroup Void | Since: base-4.9.0.0
Instance details Defined in Data.Void Methods (<>) :: Void -> Void -> Void # sconcat :: NonEmpty Void -> Void # stimes :: Integral b => b -> Void -> Void #
Exception Void | Since: base-4.8.0.0
Instance details Defined in Data.Void Methods toException :: Void -> SomeException # fromException :: SomeException -> Maybe Void # displayException :: Void -> String #
type Rep Void |
Instance details Defined in Data.Void type Rep Void = D1 ('MetaData "Void" "Data.Void" "base" 'False) (V1 :: Type -> Type)

absurd :: Void -> a #

Since `Void` values logically don't exist, this witnesses the logical reasoning tool of "ex falso quodlibet".

    >>> let x :: Either Void Int; x = Right 5
    >>> :{
    case x of
        Right r -> r
        Left l  -> absurd l
    :}
    5

Since: base-4.8.0.0

vacuous :: Functor f => f Void -> f a #

If `Void` is uninhabited then any `Functor` that holds only values of type `Void` is holding no values.

Using `ApplicativeDo`: '``vacuous` theVoid`' can be understood as the `do` expression

    do void <- theVoid
       pure (absurd void)

with an inferred `Functor` constraint.

Since: base-4.8.0.0