Maintainer | bastiaan.heeren@ou.nl |
---|---|
Stability | provisional |
Portability | portable (depends on ghc) |
Safe Haskell | None |
Language | Haskell2010 |
Documentation
Instances
Monad WithBool Source # | |
Functor WithBool Source # | |
Applicative WithBool Source # | |
Foldable WithBool Source # | |
Defined in Domain.Math.Data.WithBool fold :: Monoid m => WithBool m -> m # foldMap :: Monoid m => (a -> m) -> WithBool a -> m # foldr :: (a -> b -> b) -> b -> WithBool a -> b # foldr' :: (a -> b -> b) -> b -> WithBool a -> b # foldl :: (b -> a -> b) -> b -> WithBool a -> b # foldl' :: (b -> a -> b) -> b -> WithBool a -> b # foldr1 :: (a -> a -> a) -> WithBool a -> a # foldl1 :: (a -> a -> a) -> WithBool a -> a # elem :: Eq a => a -> WithBool a -> Bool # maximum :: Ord a => WithBool a -> a # minimum :: Ord a => WithBool a -> a # | |
Traversable WithBool Source # | |
Container WithBool Source # | |
Defined in Domain.Math.Data.WithBool | |
Eq a => Eq (WithBool a) Source # | |
Ord a => Ord (WithBool a) Source # | |
Show a => Show (WithBool a) Source # | |
Arbitrary a => Arbitrary (WithBool a) Source # | |
IsTerm a => IsTerm (WithBool a) Source # | |
BoolValue (WithBool a) Source # | |
join :: Monad m => m (m a) -> m a #
The join
function is the conventional monad join operator. It
is used to remove one level of monadic structure, projecting its
bound argument into the outer level.
Examples
A common use of join
is to run an IO
computation returned from
an STM
transaction, since STM
transactions
can't perform IO
directly. Recall that
atomically
:: STM a -> IO a
is used to run STM
transactions atomically. So, by
specializing the types of atomically
and join
to
atomically
:: STM (IO b) -> IO (IO b)join
:: IO (IO b) -> IO b
we can compose them as
join
.atomically
:: STM (IO b) -> IO b