void

void value discards or ignores the result of evaluation, such as the return value of an IO action.

Examples

Replace the contents of a Maybe Int with unit:
>>> void Nothing
Nothing
>>> void (Just 3)
Just ()
Replace the contents of an Either Int Int with unit, resulting in an Either Int ():
>>> void (Left 8675309)
Left 8675309
>>> void (Right 8675309)
Right ()
Replace every element of a list with unit:
>>> void [1,2,3]
[(),(),()]
Replace the second element of a pair with unit:
>>> void (1,2)
(1,())
Discard the result of an IO action:
>>> mapM print [1,2]
1
2
[(),()]
>>> void $ mapM print [1,2]
1
2
Deprecated: use void instead
void value discards or ignores the result of evaluation, such as the return value of an IO action. Using ApplicativeDo: 'void as' can be understood as the do expression
do as
pure ()
with an inferred Functor constraint.

Examples

Replace the contents of a Maybe Int with unit:
>>> void Nothing
Nothing

>>> void (Just 3)
Just ()
Replace the contents of an Either Int Int with unit, resulting in an Either Int ():
>>> void (Left 8675309)
Left 8675309

>>> void (Right 8675309)
Right ()
Replace every element of a list with unit:
>>> void [1,2,3]
[(),(),()]
Replace the second element of a pair with unit:
>>> void (1,2)
(1,())
Discard the result of an IO action:
>>> mapM print [1,2]
1
2
[(),()]

>>> void $ mapM print [1,2]
1
2
void value discards or ignores the result of evaluation, such as the return value of an IO action.

Examples

Replace the contents of a Maybe Int with unit:
>>> void Nothing
Nothing

>>> void (Just 3)
Just ()
Replace the contents of an Either Int Int with unit, resulting in an Either Int ():
>>> void (Left 8675309)
Left 8675309

>>> void (Right 8675309)
Right ()
Replace every element of a list with unit:
>>> void [1,2,3]
[(),(),()]
Replace the second element of a pair with unit:
>>> void (1,2)
(1,())
Discard the result of an IO action:
>>> mapM print [1,2]
1
2
[(),()]

>>> void $ mapM print [1,2]
1
2
A Haskell 98 logically uninhabited data type A Haskell 98 logically uninhabited data type, used to indicate that a given term should not exist.
Decode Void from an empty union. Since <> is uninhabited, input void will always fail.
Not all versions of "base" export void
Decode any JSON value to Void value which is impossible to construct. This Decoder is guarenteed to fail.
Encode any JSON value to Void value which is impossible to construct. This Encoder is guarenteed to fail.
void value discards or ignores the result of evaluation, such as the return value of an IO action.

Examples

Replace the contents of a Maybe Int with unit:
>>> void Nothing
Nothing

>>> void (Just 3)
Just ()
Replace the contents of an Either Int Int with unit, resulting in an Either Int '()':
>>> void (Left 8675309)
Left 8675309

>>> void (Right 8675309)
Right ()
Replace every element of a list with unit:
>>> void [1,2,3]
[(),(),()]
Replace the second element of a pair with unit:
>>> void (1,2)
(1,())
Discard the result of an IO action:
>>> mapM print [1,2]
1
2
[(),()]

>>> void $ mapM print [1,2]
1
2
A logically uninhabited data type, used to indicate that a given term should not exist.
Uninhabited data type
Uninhabited data type
TextShow instance for Void. Since: 2
Uninhabited barbie type.