ideas-math-types-1.1: Common types for mathematical domain reasoners

Maintainerbastiaan.heeren@ou.nl
Stabilityprovisional
Portabilityportable (depends on ghc)
Safe HaskellNone
LanguageHaskell2010

Domain.Math.Data.WithBool

Description

 
Synopsis

Documentation

data WithBool a Source #

Instances
Monad WithBool Source # 
Instance details

Defined in Domain.Math.Data.WithBool

Methods

(>>=) :: WithBool a -> (a -> WithBool b) -> WithBool b #

(>>) :: WithBool a -> WithBool b -> WithBool b #

return :: a -> WithBool a #

fail :: String -> WithBool a #

Functor WithBool Source # 
Instance details

Defined in Domain.Math.Data.WithBool

Methods

fmap :: (a -> b) -> WithBool a -> WithBool b #

(<$) :: a -> WithBool b -> WithBool a #

Applicative WithBool Source # 
Instance details

Defined in Domain.Math.Data.WithBool

Methods

pure :: a -> WithBool a #

(<*>) :: WithBool (a -> b) -> WithBool a -> WithBool b #

liftA2 :: (a -> b -> c) -> WithBool a -> WithBool b -> WithBool c #

(*>) :: WithBool a -> WithBool b -> WithBool b #

(<*) :: WithBool a -> WithBool b -> WithBool a #

Foldable WithBool Source # 
Instance details

Defined in Domain.Math.Data.WithBool

Methods

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 #

toList :: WithBool a -> [a] #

null :: WithBool a -> Bool #

length :: WithBool a -> Int #

elem :: Eq a => a -> WithBool a -> Bool #

maximum :: Ord a => WithBool a -> a #

minimum :: Ord a => WithBool a -> a #

sum :: Num a => WithBool a -> a #

product :: Num a => WithBool a -> a #

Traversable WithBool Source # 
Instance details

Defined in Domain.Math.Data.WithBool

Methods

traverse :: Applicative f => (a -> f b) -> WithBool a -> f (WithBool b) #

sequenceA :: Applicative f => WithBool (f a) -> f (WithBool a) #

mapM :: Monad m => (a -> m b) -> WithBool a -> m (WithBool b) #

sequence :: Monad m => WithBool (m a) -> m (WithBool a) #

Container WithBool Source # 
Instance details

Defined in Domain.Math.Data.WithBool

Methods

singleton :: a -> WithBool a #

getSingleton :: WithBool a -> Maybe a #

Eq a => Eq (WithBool a) Source # 
Instance details

Defined in Domain.Math.Data.WithBool

Methods

(==) :: WithBool a -> WithBool a -> Bool #

(/=) :: WithBool a -> WithBool a -> Bool #

Ord a => Ord (WithBool a) Source # 
Instance details

Defined in Domain.Math.Data.WithBool

Methods

compare :: WithBool a -> WithBool a -> Ordering #

(<) :: WithBool a -> WithBool a -> Bool #

(<=) :: WithBool a -> WithBool a -> Bool #

(>) :: WithBool a -> WithBool a -> Bool #

(>=) :: WithBool a -> WithBool a -> Bool #

max :: WithBool a -> WithBool a -> WithBool a #

min :: WithBool a -> WithBool a -> WithBool a #

Show a => Show (WithBool a) Source # 
Instance details

Defined in Domain.Math.Data.WithBool

Methods

showsPrec :: Int -> WithBool a -> ShowS #

show :: WithBool a -> String #

showList :: [WithBool a] -> ShowS #

Arbitrary a => Arbitrary (WithBool a) Source # 
Instance details

Defined in Domain.Math.Data.WithBool

Methods

arbitrary :: Gen (WithBool a) #

shrink :: WithBool a -> [WithBool a] #

IsTerm a => IsTerm (WithBool a) Source # 
Instance details

Defined in Domain.Math.Data.WithBool

Methods

toTerm :: WithBool a -> Term #

toTermList :: [WithBool a] -> Term #

fromTerm :: MonadPlus m => Term -> m (WithBool a) #

fromTermList :: MonadPlus m => Term -> m [WithBool a] #

BoolValue (WithBool a) Source # 
Instance details

Defined in Domain.Math.Data.WithBool

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

Expand

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

to run an STM transaction and the IO action it returns.