void module:Control.Monad

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
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
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
An empty substitution from an empty scope.
VoidS is the only explicit scope available to the users, representing an empty scope. All other scopes are represented with type variables, bound in rank-2 polymophic functions like withFreshBinder.
void with MergingStrategy knowledge propagation.
Catch the specified exception and return it instead. The evaluated computation must return Void (ie. it never returns)