| Safe Haskell | None |
|---|---|
| Language | Haskell98 |
Reactive.Banana.Combinators
Synopsis
- data Event a
- data Behavior a
- interpret :: (Event a -> Moment (Event b)) -> [Maybe a] -> IO [Maybe b]
- class Functor f => Applicative (f :: Type -> Type) where
- class Applicative f => Alternative (f :: Type -> Type) where
- (<$>) :: Functor f => (a -> b) -> f a -> f b
- (<$) :: Functor f => a -> f b -> f a
- (<**>) :: Applicative f => f a -> f (a -> b) -> f b
- liftA :: Applicative f => (a -> b) -> f a -> f b
- liftA3 :: Applicative f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d
- newtype Const a (b :: k) = Const {
- getConst :: a
- asum :: (Foldable t, Alternative f) => t (f a) -> f a
- newtype WrappedArrow (a :: Type -> Type -> Type) b c = WrapArrow {
- unwrapArrow :: a b c
- newtype WrappedMonad (m :: Type -> Type) a = WrapMonad {
- unwrapMonad :: m a
- optional :: Alternative f => f a -> f (Maybe a)
- newtype ZipList a = ZipList {
- getZipList :: [a]
- newtype Any = Any {
- getAny :: Bool
- class Semigroup a where
- newtype Min a = Min {
- getMin :: a
- newtype Max a = Max {
- getMax :: a
- data Arg a b = Arg a b
- newtype First a = First {
- getFirst :: a
- newtype Last a = Last {
- getLast :: a
- newtype All = All {
- getAll :: Bool
- newtype Dual a = Dual {
- getDual :: a
- newtype Endo a = Endo {
- appEndo :: a -> a
- newtype Product a = Product {
- getProduct :: a
- newtype Sum a = Sum {
- getSum :: a
- cycle1 :: Semigroup m => m -> m
- newtype WrappedMonoid m = WrapMonoid {
- unwrapMonoid :: m
- stimesIdempotentMonoid :: (Integral b, Monoid a) => b -> a -> a
- stimesMonoid :: (Integral b, Monoid a) => b -> a -> a
- diff :: Semigroup m => m -> Endo m
- mtimesDefault :: (Integral b, Monoid a) => b -> a -> a
- stimesIdempotent :: Integral b => b -> a -> a
- type ArgMax a b = Max (Arg a b)
- type ArgMin a b = Min (Arg a b)
- never :: Event a
- unionWith :: (a -> a -> a) -> Event a -> Event a -> Event a
- filterE :: (a -> Bool) -> Event a -> Event a
- apply :: Behavior (a -> b) -> Event a -> Event b
- data Moment a
- class MonadFix m => MonadMoment (m :: Type -> Type) where
- liftMoment :: Moment a -> m a
- accumE :: MonadMoment m => a -> Event (a -> a) -> m (Event a)
- stepper :: MonadMoment m => a -> Event a -> m (Behavior a)
- valueB :: MonadMoment m => Behavior a -> m a
- valueBLater :: MonadMoment m => Behavior a -> m a
- observeE :: Event (Moment a) -> Event a
- switchE :: MonadMoment m => Event a -> Event (Event a) -> m (Event a)
- switchB :: MonadMoment m => Behavior a -> Event (Behavior a) -> m (Behavior a)
- (<@>) :: Behavior (a -> b) -> Event a -> Event b
- (<@) :: Behavior b -> Event a -> Event b
- (@>) :: Event a -> Behavior b -> Event b
- filterJust :: Event (Maybe a) -> Event a
- filterApply :: Behavior (a -> Bool) -> Event a -> Event a
- whenE :: Behavior Bool -> Event a -> Event a
- split :: Event (Either a b) -> (Event a, Event b)
- once :: MonadMoment m => Event a -> m (Event a)
- unions :: [Event (a -> a)] -> Event (a -> a)
- accumB :: MonadMoment m => a -> Event (a -> a) -> m (Behavior a)
- mapAccum :: MonadMoment m => acc -> Event (acc -> (x, acc)) -> m (Event x, Behavior acc)
- merge :: Event a -> Event b -> Event (These a b)
- mergeWith :: (a -> c) -> (b -> c) -> (a -> b -> c) -> Event a -> Event b -> Event c
Synopsis
The main types and combinators of Functional Reactive Programming (FRP).
At its core, FRP is about two data types Event and Behavior
and the various ways to combine them.
There is also a third type Moment,
which is necessary for the higher-order combinators.
Core Combinators
Event and Behavior
Event a represents a stream of events as they occur in time.
Semantically, you can think of Event a as an infinite list of values
that are tagged with their corresponding time of occurrence,
type Event a = [(Time,a)]
Each pair is called an event occurrence. Note that within a single event stream, no two event occurrences may happen at the same time.

Instances
| Functor Event Source # | The function fmap :: (a -> b) -> Event a -> Event b fmap f e = [(time, f a) | (time, a) <- e] |
| Semigroup a => Monoid (Event a) Source # | The combinator mempty :: Event a mempty = never |
| Semigroup a => Semigroup (Event a) Source # | The combinator (<>) :: Event a -> Event a -> Event a (<>) ex ey = unionWith (<>) ex ey |
Behavior a represents a value that varies in time.
Semantically, you can think of it as a function
type Behavior a = Time -> a

Instances
| Applicative Behavior Source # | The function pure :: a -> Behavior a pure x = \time -> x The combinator (<*>) :: Behavior (a -> b) -> Behavior a -> Behavior b fx <*> bx = \time -> fx time $ bx time |
| Functor Behavior Source # | The function fmap :: (a -> b) -> Behavior a -> Behavior b fmap f b = \time -> f (b time) |
| (Semigroup a, Monoid a) => Monoid (Behavior a) Source # | |
| Semigroup a => Semigroup (Behavior a) Source # | |
| IsString a => IsString (Behavior a) Source # | |
Defined in Reactive.Banana.Types Methods fromString :: String -> Behavior a | |
| Floating a => Floating (Behavior a) Source # | |
Defined in Reactive.Banana.Types Methods exp :: Behavior a -> Behavior a log :: Behavior a -> Behavior a sqrt :: Behavior a -> Behavior a (**) :: Behavior a -> Behavior a -> Behavior a logBase :: Behavior a -> Behavior a -> Behavior a sin :: Behavior a -> Behavior a cos :: Behavior a -> Behavior a tan :: Behavior a -> Behavior a asin :: Behavior a -> Behavior a acos :: Behavior a -> Behavior a atan :: Behavior a -> Behavior a sinh :: Behavior a -> Behavior a cosh :: Behavior a -> Behavior a tanh :: Behavior a -> Behavior a asinh :: Behavior a -> Behavior a acosh :: Behavior a -> Behavior a atanh :: Behavior a -> Behavior a log1p :: Behavior a -> Behavior a expm1 :: Behavior a -> Behavior a | |
| Num a => Num (Behavior a) Source # | |
Defined in Reactive.Banana.Types | |
| Fractional a => Fractional (Behavior a) Source # | |
Defined in Reactive.Banana.Types | |
interpret :: (Event a -> Moment (Event b)) -> [Maybe a] -> IO [Maybe b] Source #
Interpret an event processing function. Useful for testing.
Note: You can safely assume that this function is pure,
even though the type seems to suggest otherwise.
I'm really sorry about the extra IO, but it can't be helped.
See source code for the sordid details.
First-order
This subsections lists the primitive first-order combinators for FRP.
The Functor, Applicative and Monoid instances are also part of this,
but they are documented at the types Event and Behavior.
class Functor f => Applicative (f :: Type -> Type) where #
Instances
| Applicative Complex | |
| Applicative First | |
| Applicative Last | |
| Applicative Max | |
| Applicative Min | |
| Applicative Put | |
| Applicative Seq | |
| Applicative Tree | |
| Applicative NonEmpty | |
| Applicative STM | |
| Applicative Identity | |
| Applicative Down | |
| Applicative Dual | |
| Applicative Product | |
| Applicative Sum | |
| Applicative ZipList | |
| Applicative Par1 | |
| Applicative P | |
| Applicative ReadP | |
| Applicative ReadPrec | |
Defined in GHC.Internal.Text.ParserCombinators.ReadPrec | |
| Applicative IO | |
| Applicative Behavior Source # | |
| Applicative Moment Source # | |
| Applicative Behavior Source # | The function pure :: a -> Behavior a pure x = \time -> x The combinator (<*>) :: Behavior (a -> b) -> Behavior a -> Behavior b fx <*> bx = \time -> fx time $ bx time |
| Applicative Future Source # | |
| Applicative Moment Source # | |
| Applicative MomentIO Source # | |
| Applicative Q | |
| Applicative Maybe | |
| Applicative Solo | |
| Applicative [] | |
| Monad m => Applicative (WrappedMonad m) | |
Defined in Control.Applicative Methods pure :: a -> WrappedMonad m a # (<*>) :: WrappedMonad m (a -> b) -> WrappedMonad m a -> WrappedMonad m b # liftA2 :: (a -> b -> c) -> WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m c # (*>) :: WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m b # (<*) :: WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m a # | |
| Applicative (SetM s) | |
| Applicative (Either e) | |
| Applicative (U1 :: Type -> Type) | |
| Semigroup a => Applicative (These a) | |
| Applicative f => Applicative (Lift f) | |
| (Functor m, Monad m) => Applicative (MaybeT m) | |
| Monoid a => Applicative ((,) a) | |
| Arrow a => Applicative (WrappedArrow a b) | |
Defined in Control.Applicative Methods pure :: a0 -> WrappedArrow a b a0 # (<*>) :: WrappedArrow a b (a0 -> b0) -> WrappedArrow a b a0 -> WrappedArrow a b b0 # liftA2 :: (a0 -> b0 -> c) -> WrappedArrow a b a0 -> WrappedArrow a b b0 -> WrappedArrow a b c # (*>) :: WrappedArrow a b a0 -> WrappedArrow a b b0 -> WrappedArrow a b b0 # (<*) :: WrappedArrow a b a0 -> WrappedArrow a b b0 -> WrappedArrow a b a0 # | |
| (Applicative f, Monad f) => Applicative (WhenMissing f x) | |
Defined in Data.IntMap.Internal Methods pure :: a -> WhenMissing f x a # (<*>) :: WhenMissing f x (a -> b) -> WhenMissing f x a -> WhenMissing f x b # liftA2 :: (a -> b -> c) -> WhenMissing f x a -> WhenMissing f x b -> WhenMissing f x c # (*>) :: WhenMissing f x a -> WhenMissing f x b -> WhenMissing f x b # (<*) :: WhenMissing f x a -> WhenMissing f x b -> WhenMissing f x a # | |
| Monoid m => Applicative (Const m :: Type -> Type) | |
| Applicative f => Applicative (Alt f) | |
| (Generic1 f, Applicative (Rep1 f)) => Applicative (Generically1 f) | |
Defined in GHC.Internal.Generics Methods pure :: a -> Generically1 f a # (<*>) :: Generically1 f (a -> b) -> Generically1 f a -> Generically1 f b # liftA2 :: (a -> b -> c) -> Generically1 f a -> Generically1 f b -> Generically1 f c # (*>) :: Generically1 f a -> Generically1 f b -> Generically1 f b # (<*) :: Generically1 f a -> Generically1 f b -> Generically1 f a # | |
| Applicative f => Applicative (Rec1 f) | |
| Applicative f => Applicative (Backwards f) | |
Defined in Control.Applicative.Backwards | |
| (Monoid w, Functor m, Monad m) => Applicative (AccumT w m) | |
Defined in Control.Monad.Trans.Accum | |
| (Functor m, Monad m) => Applicative (ExceptT e m) | |
Defined in Control.Monad.Trans.Except | |
| Applicative m => Applicative (IdentityT m) | |
Defined in Control.Monad.Trans.Identity | |
| Applicative m => Applicative (ReaderT r m) | |
Defined in Control.Monad.Trans.Reader | |
| (Functor m, Monad m) => Applicative (SelectT r m) | |
Defined in Control.Monad.Trans.Select | |
| (Functor m, Monad m) => Applicative (StateT s m) | |
Defined in Control.Monad.Trans.State.Lazy | |
| (Functor m, Monad m) => Applicative (StateT s m) | |
Defined in Control.Monad.Trans.State.Strict | |
| (Functor m, Monad m) => Applicative (WriterT w m) | |
Defined in Control.Monad.Trans.Writer.CPS | |
| (Monoid w, Applicative m) => Applicative (WriterT w m) | |
Defined in Control.Monad.Trans.Writer.Lazy | |
| (Monoid w, Applicative m) => Applicative (WriterT w m) | |
Defined in Control.Monad.Trans.Writer.Strict | |
| Monoid a => Applicative (Constant a :: Type -> Type) | |
Defined in Data.Functor.Constant | |
| Applicative f => Applicative (Reverse f) | |
| (Monoid a, Monoid b) => Applicative ((,,) a b) | |
| (Applicative f, Applicative g) => Applicative (Product f g) | |
Defined in Data.Functor.Product | |
| (Monad f, Applicative f) => Applicative (WhenMatched f x y) | |
Defined in Data.IntMap.Internal Methods pure :: a -> WhenMatched f x y a # (<*>) :: WhenMatched f x y (a -> b) -> WhenMatched f x y a -> WhenMatched f x y b # liftA2 :: (a -> b -> c) -> WhenMatched f x y a -> WhenMatched f x y b -> WhenMatched f x y c # (*>) :: WhenMatched f x y a -> WhenMatched f x y b -> WhenMatched f x y b # (<*) :: WhenMatched f x y a -> WhenMatched f x y b -> WhenMatched f x y a # | |
| (Applicative f, Monad f) => Applicative (WhenMissing f k x) | |
Defined in Data.Map.Internal Methods pure :: a -> WhenMissing f k x a # (<*>) :: WhenMissing f k x (a -> b) -> WhenMissing f k x a -> WhenMissing f k x b # liftA2 :: (a -> b -> c) -> WhenMissing f k x a -> WhenMissing f k x b -> WhenMissing f k x c # (*>) :: WhenMissing f k x a -> WhenMissing f k x b -> WhenMissing f k x b # (<*) :: WhenMissing f k x a -> WhenMissing f k x b -> WhenMissing f k x a # | |
| (Applicative f, Applicative g) => Applicative (f :*: g) | |
| Monoid c => Applicative (K1 i c :: Type -> Type) | |
| Applicative (ContT r m) | |
Defined in Control.Monad.Trans.Cont | |
| (Monoid a, Monoid b, Monoid c) => Applicative ((,,,) a b c) | |
Defined in GHC.Internal.Base | |
| Applicative ((->) r) | |
| (Applicative f, Applicative g) => Applicative (Compose f g) | |
Defined in Data.Functor.Compose | |
| (Monad f, Applicative f) => Applicative (WhenMatched f k x y) | |
Defined in Data.Map.Internal Methods pure :: a -> WhenMatched f k x y a # (<*>) :: WhenMatched f k x y (a -> b) -> WhenMatched f k x y a -> WhenMatched f k x y b # liftA2 :: (a -> b -> c) -> WhenMatched f k x y a -> WhenMatched f k x y b -> WhenMatched f k x y c # (*>) :: WhenMatched f k x y a -> WhenMatched f k x y b -> WhenMatched f k x y b # (<*) :: WhenMatched f k x y a -> WhenMatched f k x y b -> WhenMatched f k x y a # | |
| (Applicative f, Applicative g) => Applicative (f :.: g) | |
| Applicative f => Applicative (M1 i c f) | |
| (Functor m, Monad m) => Applicative (RWST r w s m) | |
Defined in Control.Monad.Trans.RWS.CPS | |
| (Monoid w, Functor m, Monad m) => Applicative (RWST r w s m) | |
Defined in Control.Monad.Trans.RWS.Lazy | |
| (Monoid w, Functor m, Monad m) => Applicative (RWST r w s m) | |
Defined in Control.Monad.Trans.RWS.Strict | |
class Applicative f => Alternative (f :: Type -> Type) where #
Instances
| Alternative Seq | |
| Alternative STM | |
| Alternative ZipList | |
| Alternative P | |
| Alternative ReadP | |
| Alternative ReadPrec | |
| Alternative IO | |
| Alternative Maybe | |
| Alternative [] | |
| MonadPlus m => Alternative (WrappedMonad m) | |
Defined in Control.Applicative Methods empty :: WrappedMonad m a # (<|>) :: WrappedMonad m a -> WrappedMonad m a -> WrappedMonad m a # some :: WrappedMonad m a -> WrappedMonad m [a] # many :: WrappedMonad m a -> WrappedMonad m [a] # | |
| Alternative (U1 :: Type -> Type) | |
| Alternative f => Alternative (Lift f) | |
| (Functor m, Monad m) => Alternative (MaybeT m) | |
| (ArrowZero a, ArrowPlus a) => Alternative (WrappedArrow a b) | |
Defined in Control.Applicative Methods empty :: WrappedArrow a b a0 # (<|>) :: WrappedArrow a b a0 -> WrappedArrow a b a0 -> WrappedArrow a b a0 # some :: WrappedArrow a b a0 -> WrappedArrow a b [a0] # many :: WrappedArrow a b a0 -> WrappedArrow a b [a0] # | |
| Alternative f => Alternative (Alt f) | |
| (Generic1 f, Alternative (Rep1 f)) => Alternative (Generically1 f) | |
| Alternative f => Alternative (Rec1 f) | |
| Alternative f => Alternative (Backwards f) | |
| (Monoid w, Functor m, MonadPlus m) => Alternative (AccumT w m) | |
| (Functor m, Monad m, Monoid e) => Alternative (ExceptT e m) | |
| Alternative m => Alternative (IdentityT m) | |
| Alternative m => Alternative (ReaderT r m) | |
| (Functor m, MonadPlus m) => Alternative (SelectT r m) | |
| (Functor m, MonadPlus m) => Alternative (StateT s m) | |
| (Functor m, MonadPlus m) => Alternative (StateT s m) | |
| (Functor m, MonadPlus m) => Alternative (WriterT w m) | |
| (Monoid w, Alternative m) => Alternative (WriterT w m) | |
| (Monoid w, Alternative m) => Alternative (WriterT w m) | |
| Alternative f => Alternative (Reverse f) | |
| (Alternative f, Alternative g) => Alternative (Product f g) | |
| (Alternative f, Alternative g) => Alternative (f :*: g) | |
| (Alternative f, Applicative g) => Alternative (Compose f g) | |
| (Alternative f, Applicative g) => Alternative (f :.: g) | |
| Alternative f => Alternative (M1 i c f) | |
| (Functor m, MonadPlus m) => Alternative (RWST r w s m) | |
| (Monoid w, Functor m, MonadPlus m) => Alternative (RWST r w s m) | |
| (Monoid w, Functor m, MonadPlus m) => Alternative (RWST r w s m) | |
(<**>) :: Applicative f => f a -> f (a -> b) -> f b #
liftA :: Applicative f => (a -> b) -> f a -> f b #
liftA3 :: Applicative f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d #
Instances
| Generic1 (Const a :: k -> Type) | |||||
Defined in GHC.Internal.Data.Functor.Const Associated Types
| |||||
| Bifoldable (Const :: Type -> Type -> Type) | |||||
| Bifoldable1 (Const :: Type -> Type -> Type) | |||||
Defined in Data.Bifoldable1 | |||||
| Bifunctor (Const :: Type -> Type -> Type) | |||||
| Bitraversable (Const :: Type -> Type -> Type) | |||||
Defined in Data.Bitraversable Methods bitraverse :: Applicative f => (a -> f c) -> (b -> f d) -> Const a b -> f (Const c d) | |||||
| Eq2 (Const :: Type -> Type -> Type) | |||||
Defined in Data.Functor.Classes | |||||
| Ord2 (Const :: Type -> Type -> Type) | |||||
Defined in Data.Functor.Classes Methods liftCompare2 :: (a -> b -> Ordering) -> (c -> d -> Ordering) -> Const a c -> Const b d -> Ordering | |||||
| Read2 (Const :: Type -> Type -> Type) | |||||
Defined in Data.Functor.Classes Methods liftReadsPrec2 :: (Int -> ReadS a) -> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> Int -> ReadS (Const a b) liftReadList2 :: (Int -> ReadS a) -> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> ReadS [Const a b] liftReadPrec2 :: ReadPrec a -> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec (Const a b) liftReadListPrec2 :: ReadPrec a -> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec [Const a b] | |||||
| Show2 (Const :: Type -> Type -> Type) | |||||
Defined in Data.Functor.Classes Methods liftShowsPrec2 :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> (Int -> b -> ShowS) -> ([b] -> ShowS) -> Int -> Const a b -> ShowS liftShowList2 :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> (Int -> b -> ShowS) -> ([b] -> ShowS) -> [Const a b] -> ShowS | |||||
| NFData2 (Const :: Type -> Type -> Type) | |||||
Defined in Control.DeepSeq | |||||
| Hashable2 (Const :: Type -> Type -> Type) | |||||
Defined in Data.Hashable.Class Methods liftHashWithSalt2 :: (Int -> a -> Int) -> (Int -> b -> Int) -> Int -> Const a b -> Int Source # | |||||
| Eq a => Eq1 (Const a :: Type -> Type) | |||||
Defined in Data.Functor.Classes | |||||
| Ord a => Ord1 (Const a :: Type -> Type) | |||||
Defined in Data.Functor.Classes Methods liftCompare :: (a0 -> b -> Ordering) -> Const a a0 -> Const a b -> Ordering | |||||
| Read a => Read1 (Const a :: Type -> Type) | |||||
Defined in Data.Functor.Classes Methods liftReadsPrec :: (Int -> ReadS a0) -> ReadS [a0] -> Int -> ReadS (Const a a0) liftReadList :: (Int -> ReadS a0) -> ReadS [a0] -> ReadS [Const a a0] liftReadPrec :: ReadPrec a0 -> ReadPrec [a0] -> ReadPrec (Const a a0) liftReadListPrec :: ReadPrec a0 -> ReadPrec [a0] -> ReadPrec [Const a a0] | |||||
| Show a => Show1 (Const a :: Type -> Type) | |||||
Defined in Data.Functor.Classes Methods liftShowsPrec :: (Int -> a0 -> ShowS) -> ([a0] -> ShowS) -> Int -> Const a a0 -> ShowS liftShowList :: (Int -> a0 -> ShowS) -> ([a0] -> ShowS) -> [Const a a0] -> ShowS | |||||
| Contravariant (Const a :: Type -> Type) | |||||
| NFData a => NFData1 (Const a :: Type -> Type) | |||||
Defined in Control.DeepSeq | |||||
| Monoid m => Applicative (Const m :: Type -> Type) | |||||
| Functor (Const m :: Type -> Type) | |||||
| Foldable (Const m :: Type -> Type) | |||||
Defined in GHC.Internal.Data.Functor.Const Methods fold :: Monoid m0 => Const m m0 -> m0 foldMap :: Monoid m0 => (a -> m0) -> Const m a -> m0 foldMap' :: Monoid m0 => (a -> m0) -> Const m a -> m0 foldr :: (a -> b -> b) -> b -> Const m a -> b foldr' :: (a -> b -> b) -> b -> Const m a -> b foldl :: (b -> a -> b) -> b -> Const m a -> b foldl' :: (b -> a -> b) -> b -> Const m a -> b foldr1 :: (a -> a -> a) -> Const m a -> a foldl1 :: (a -> a -> a) -> Const m a -> a elem :: Eq a => a -> Const m a -> Bool maximum :: Ord a => Const m a -> a minimum :: Ord a => Const m a -> a | |||||
| Traversable (Const m :: Type -> Type) | |||||
Defined in GHC.Internal.Data.Traversable | |||||
| Hashable a => Hashable1 (Const a :: Type -> Type) | |||||
Defined in Data.Hashable.Class Methods liftHashWithSalt :: (Int -> a0 -> Int) -> Int -> Const a a0 -> Int Source # | |||||
| NFData a => NFData (Const a b) | |||||
Defined in Control.DeepSeq | |||||
| Monoid a => Monoid (Const a b) | |||||
| Semigroup a => Semigroup (Const a b) | |||||
| Bits a => Bits (Const a b) | |||||
Defined in GHC.Internal.Data.Functor.Const Methods (.&.) :: Const a b -> Const a b -> Const a b (.|.) :: Const a b -> Const a b -> Const a b xor :: Const a b -> Const a b -> Const a b complement :: Const a b -> Const a b shift :: Const a b -> Int -> Const a b rotate :: Const a b -> Int -> Const a b setBit :: Const a b -> Int -> Const a b clearBit :: Const a b -> Int -> Const a b complementBit :: Const a b -> Int -> Const a b testBit :: Const a b -> Int -> Bool bitSizeMaybe :: Const a b -> Maybe Int shiftL :: Const a b -> Int -> Const a b unsafeShiftL :: Const a b -> Int -> Const a b shiftR :: Const a b -> Int -> Const a b unsafeShiftR :: Const a b -> Int -> Const a b rotateL :: Const a b -> Int -> Const a b | |||||
| FiniteBits a => FiniteBits (Const a b) | |||||
Defined in GHC.Internal.Data.Functor.Const Methods finiteBitSize :: Const a b -> Int countLeadingZeros :: Const a b -> Int countTrailingZeros :: Const a b -> Int | |||||
| IsString a => IsString (Const a b) | |||||
Defined in GHC.Internal.Data.String Methods fromString :: String -> Const a b | |||||
| Bounded a => Bounded (Const a b) | |||||
Defined in GHC.Internal.Data.Functor.Const | |||||
| Enum a => Enum (Const a b) | |||||
Defined in GHC.Internal.Data.Functor.Const | |||||
| Floating a => Floating (Const a b) | |||||
Defined in GHC.Internal.Data.Functor.Const Methods sqrt :: Const a b -> Const a b (**) :: Const a b -> Const a b -> Const a b logBase :: Const a b -> Const a b -> Const a b asin :: Const a b -> Const a b acos :: Const a b -> Const a b atan :: Const a b -> Const a b sinh :: Const a b -> Const a b cosh :: Const a b -> Const a b tanh :: Const a b -> Const a b asinh :: Const a b -> Const a b acosh :: Const a b -> Const a b atanh :: Const a b -> Const a b log1p :: Const a b -> Const a b expm1 :: Const a b -> Const a b | |||||
| RealFloat a => RealFloat (Const a b) | |||||
Defined in GHC.Internal.Data.Functor.Const Methods floatRadix :: Const a b -> Integer floatDigits :: Const a b -> Int floatRange :: Const a b -> (Int, Int) decodeFloat :: Const a b -> (Integer, Int) encodeFloat :: Integer -> Int -> Const a b significand :: Const a b -> Const a b scaleFloat :: Int -> Const a b -> Const a b isInfinite :: Const a b -> Bool isDenormalized :: Const a b -> Bool isNegativeZero :: Const a b -> Bool | |||||
| Storable a => Storable (Const a b) | |||||
Defined in GHC.Internal.Data.Functor.Const Methods peekElemOff :: Ptr (Const a b) -> Int -> IO (Const a b) pokeElemOff :: Ptr (Const a b) -> Int -> Const a b -> IO () peekByteOff :: Ptr b0 -> Int -> IO (Const a b) pokeByteOff :: Ptr b0 -> Int -> Const a b -> IO () | |||||
| Generic (Const a b) | |||||
Defined in GHC.Internal.Data.Functor.Const Associated Types
| |||||
| Ix a => Ix (Const a b) | |||||
Defined in GHC.Internal.Data.Functor.Const Methods range :: (Const a b, Const a b) -> [Const a b] index :: (Const a b, Const a b) -> Const a b -> Int unsafeIndex :: (Const a b, Const a b) -> Const a b -> Int inRange :: (Const a b, Const a b) -> Const a b -> Bool rangeSize :: (Const a b, Const a b) -> Int unsafeRangeSize :: (Const a b, Const a b) -> Int | |||||
| Num a => Num (Const a b) | |||||
Defined in GHC.Internal.Data.Functor.Const | |||||
| Read a => Read (Const a b) | |||||
Defined in GHC.Internal.Data.Functor.Const | |||||
| Fractional a => Fractional (Const a b) | |||||
Defined in GHC.Internal.Data.Functor.Const | |||||
| Integral a => Integral (Const a b) | |||||
Defined in GHC.Internal.Data.Functor.Const | |||||
| Real a => Real (Const a b) | |||||
Defined in GHC.Internal.Data.Functor.Const Methods toRational :: Const a b -> Rational | |||||
| RealFrac a => RealFrac (Const a b) | |||||
| Show a => Show (Const a b) | |||||
| Eq a => Eq (Const a b) | |||||
| Ord a => Ord (Const a b) | |||||
Defined in GHC.Internal.Data.Functor.Const | |||||
| Hashable a => Hashable (Const a b) | |||||
Defined in Data.Hashable.Class | |||||
| type Rep1 (Const a :: k -> Type) | |||||
Defined in GHC.Internal.Data.Functor.Const type Rep1 (Const a :: k -> Type) = D1 ('MetaData "Const" "GHC.Internal.Data.Functor.Const" "ghc-internal" 'True) (C1 ('MetaCons "Const" 'PrefixI 'True) (S1 ('MetaSel ('Just "getConst") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a))) | |||||
| type Rep (Const a b) | |||||
Defined in GHC.Internal.Data.Functor.Const type Rep (Const a b) = D1 ('MetaData "Const" "GHC.Internal.Data.Functor.Const" "ghc-internal" 'True) (C1 ('MetaCons "Const" 'PrefixI 'True) (S1 ('MetaSel ('Just "getConst") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a))) | |||||
asum :: (Foldable t, Alternative f) => t (f a) -> f a #
newtype WrappedArrow (a :: Type -> Type -> Type) b c #
Constructors
| WrapArrow | |
Fields
| |
Instances
| Generic1 (WrappedArrow a b :: Type -> Type) | |||||
Defined in Control.Applicative Associated Types
Methods from1 :: WrappedArrow a b a0 -> Rep1 (WrappedArrow a b) a0 to1 :: Rep1 (WrappedArrow a b) a0 -> WrappedArrow a b a0 | |||||
| (ArrowZero a, ArrowPlus a) => Alternative (WrappedArrow a b) | |||||
Defined in Control.Applicative Methods empty :: WrappedArrow a b a0 # (<|>) :: WrappedArrow a b a0 -> WrappedArrow a b a0 -> WrappedArrow a b a0 # some :: WrappedArrow a b a0 -> WrappedArrow a b [a0] # many :: WrappedArrow a b a0 -> WrappedArrow a b [a0] # | |||||
| Arrow a => Applicative (WrappedArrow a b) | |||||
Defined in Control.Applicative Methods pure :: a0 -> WrappedArrow a b a0 # (<*>) :: WrappedArrow a b (a0 -> b0) -> WrappedArrow a b a0 -> WrappedArrow a b b0 # liftA2 :: (a0 -> b0 -> c) -> WrappedArrow a b a0 -> WrappedArrow a b b0 -> WrappedArrow a b c # (*>) :: WrappedArrow a b a0 -> WrappedArrow a b b0 -> WrappedArrow a b b0 # (<*) :: WrappedArrow a b a0 -> WrappedArrow a b b0 -> WrappedArrow a b a0 # | |||||
| Arrow a => Functor (WrappedArrow a b) | |||||
Defined in Control.Applicative Methods fmap :: (a0 -> b0) -> WrappedArrow a b a0 -> WrappedArrow a b b0 (<$) :: a0 -> WrappedArrow a b b0 -> WrappedArrow a b a0 # | |||||
| (Typeable a, Typeable b, Typeable c, Data (a b c)) => Data (WrappedArrow a b c) | |||||
Defined in Control.Applicative Methods gfoldl :: (forall d b0. Data d => c0 (d -> b0) -> d -> c0 b0) -> (forall g. g -> c0 g) -> WrappedArrow a b c -> c0 (WrappedArrow a b c) gunfold :: (forall b0 r. Data b0 => c0 (b0 -> r) -> c0 r) -> (forall r. r -> c0 r) -> Constr -> c0 (WrappedArrow a b c) toConstr :: WrappedArrow a b c -> Constr dataTypeOf :: WrappedArrow a b c -> DataType dataCast1 :: Typeable t => (forall d. Data d => c0 (t d)) -> Maybe (c0 (WrappedArrow a b c)) dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c0 (t d e)) -> Maybe (c0 (WrappedArrow a b c)) gmapT :: (forall b0. Data b0 => b0 -> b0) -> WrappedArrow a b c -> WrappedArrow a b c gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> WrappedArrow a b c -> r gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> WrappedArrow a b c -> r gmapQ :: (forall d. Data d => d -> u) -> WrappedArrow a b c -> [u] gmapQi :: Int -> (forall d. Data d => d -> u) -> WrappedArrow a b c -> u gmapM :: Monad m => (forall d. Data d => d -> m d) -> WrappedArrow a b c -> m (WrappedArrow a b c) gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> WrappedArrow a b c -> m (WrappedArrow a b c) gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> WrappedArrow a b c -> m (WrappedArrow a b c) | |||||
| Generic (WrappedArrow a b c) | |||||
Defined in Control.Applicative Associated Types
Methods from :: WrappedArrow a b c -> Rep (WrappedArrow a b c) x to :: Rep (WrappedArrow a b c) x -> WrappedArrow a b c | |||||
| type Rep1 (WrappedArrow a b :: Type -> Type) | |||||
Defined in Control.Applicative type Rep1 (WrappedArrow a b :: Type -> Type) = D1 ('MetaData "WrappedArrow" "Control.Applicative" "base" 'True) (C1 ('MetaCons "WrapArrow" 'PrefixI 'True) (S1 ('MetaSel ('Just "unwrapArrow") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 (a b)))) | |||||
| type Rep (WrappedArrow a b c) | |||||
Defined in Control.Applicative type Rep (WrappedArrow a b c) = D1 ('MetaData "WrappedArrow" "Control.Applicative" "base" 'True) (C1 ('MetaCons "WrapArrow" 'PrefixI 'True) (S1 ('MetaSel ('Just "unwrapArrow") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (a b c)))) | |||||
newtype WrappedMonad (m :: Type -> Type) a #
Constructors
| WrapMonad | |
Fields
| |
Instances
| Generic1 (WrappedMonad m :: Type -> Type) | |||||
Defined in Control.Applicative Associated Types
Methods from1 :: WrappedMonad m a -> Rep1 (WrappedMonad m) a to1 :: Rep1 (WrappedMonad m) a -> WrappedMonad m a | |||||
| MonadPlus m => Alternative (WrappedMonad m) | |||||
Defined in Control.Applicative Methods empty :: WrappedMonad m a # (<|>) :: WrappedMonad m a -> WrappedMonad m a -> WrappedMonad m a # some :: WrappedMonad m a -> WrappedMonad m [a] # many :: WrappedMonad m a -> WrappedMonad m [a] # | |||||
| Monad m => Applicative (WrappedMonad m) | |||||
Defined in Control.Applicative Methods pure :: a -> WrappedMonad m a # (<*>) :: WrappedMonad m (a -> b) -> WrappedMonad m a -> WrappedMonad m b # liftA2 :: (a -> b -> c) -> WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m c # (*>) :: WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m b # (<*) :: WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m a # | |||||
| Monad m => Functor (WrappedMonad m) | |||||
Defined in Control.Applicative Methods fmap :: (a -> b) -> WrappedMonad m a -> WrappedMonad m b (<$) :: a -> WrappedMonad m b -> WrappedMonad m a # | |||||
| Monad m => Monad (WrappedMonad m) | |||||
Defined in Control.Applicative Methods (>>=) :: WrappedMonad m a -> (a -> WrappedMonad m b) -> WrappedMonad m b (>>) :: WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m b return :: a -> WrappedMonad m a | |||||
| (Typeable m, Typeable a, Data (m a)) => Data (WrappedMonad m a) | |||||
Defined in Control.Applicative Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> WrappedMonad m a -> c (WrappedMonad m a) gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (WrappedMonad m a) toConstr :: WrappedMonad m a -> Constr dataTypeOf :: WrappedMonad m a -> DataType dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (WrappedMonad m a)) dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (WrappedMonad m a)) gmapT :: (forall b. Data b => b -> b) -> WrappedMonad m a -> WrappedMonad m a gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> WrappedMonad m a -> r gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> WrappedMonad m a -> r gmapQ :: (forall d. Data d => d -> u) -> WrappedMonad m a -> [u] gmapQi :: Int -> (forall d. Data d => d -> u) -> WrappedMonad m a -> u gmapM :: Monad m0 => (forall d. Data d => d -> m0 d) -> WrappedMonad m a -> m0 (WrappedMonad m a) gmapMp :: MonadPlus m0 => (forall d. Data d => d -> m0 d) -> WrappedMonad m a -> m0 (WrappedMonad m a) gmapMo :: MonadPlus m0 => (forall d. Data d => d -> m0 d) -> WrappedMonad m a -> m0 (WrappedMonad m a) | |||||
| Generic (WrappedMonad m a) | |||||
Defined in Control.Applicative Associated Types
Methods from :: WrappedMonad m a -> Rep (WrappedMonad m a) x to :: Rep (WrappedMonad m a) x -> WrappedMonad m a | |||||
| type Rep1 (WrappedMonad m :: Type -> Type) | |||||
Defined in Control.Applicative type Rep1 (WrappedMonad m :: Type -> Type) = D1 ('MetaData "WrappedMonad" "Control.Applicative" "base" 'True) (C1 ('MetaCons "WrapMonad" 'PrefixI 'True) (S1 ('MetaSel ('Just "unwrapMonad") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 m))) | |||||
| type Rep (WrappedMonad m a) | |||||
Defined in Control.Applicative type Rep (WrappedMonad m a) = D1 ('MetaData "WrappedMonad" "Control.Applicative" "base" 'True) (C1 ('MetaCons "WrapMonad" 'PrefixI 'True) (S1 ('MetaSel ('Just "unwrapMonad") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (m a)))) | |||||
optional :: Alternative f => f a -> f (Maybe a) #
Constructors
| ZipList | |
Fields
| |
Instances
| NFData1 ZipList | |||||
Defined in Control.DeepSeq | |||||
| Alternative ZipList | |||||
| Applicative ZipList | |||||
| Functor ZipList | |||||
| Foldable ZipList | |||||
Defined in GHC.Internal.Functor.ZipList Methods fold :: Monoid m => ZipList m -> m foldMap :: Monoid m => (a -> m) -> ZipList a -> m foldMap' :: Monoid m => (a -> m) -> ZipList a -> m foldr :: (a -> b -> b) -> b -> ZipList a -> b foldr' :: (a -> b -> b) -> b -> ZipList a -> b foldl :: (b -> a -> b) -> b -> ZipList a -> b foldl' :: (b -> a -> b) -> b -> ZipList a -> b foldr1 :: (a -> a -> a) -> ZipList a -> a foldl1 :: (a -> a -> a) -> ZipList a -> a elem :: Eq a => a -> ZipList a -> Bool maximum :: Ord a => ZipList a -> a minimum :: Ord a => ZipList a -> a | |||||
| Traversable ZipList | |||||
Defined in GHC.Internal.Functor.ZipList | |||||
| Generic1 ZipList | |||||
Defined in GHC.Internal.Functor.ZipList Associated Types
| |||||
| NFData a => NFData (ZipList a) | |||||
Defined in Control.DeepSeq | |||||
| Data a => Data (ZipList a) | |||||
Defined in GHC.Internal.Functor.ZipList Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ZipList a -> c (ZipList a) gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (ZipList a) toConstr :: ZipList a -> Constr dataTypeOf :: ZipList a -> DataType dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (ZipList a)) dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (ZipList a)) gmapT :: (forall b. Data b => b -> b) -> ZipList a -> ZipList a gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ZipList a -> r gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ZipList a -> r gmapQ :: (forall d. Data d => d -> u) -> ZipList a -> [u] gmapQi :: Int -> (forall d. Data d => d -> u) -> ZipList a -> u gmapM :: Monad m => (forall d. Data d => d -> m d) -> ZipList a -> m (ZipList a) gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ZipList a -> m (ZipList a) gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ZipList a -> m (ZipList a) | |||||
| Generic (ZipList a) | |||||
Defined in GHC.Internal.Functor.ZipList Associated Types
| |||||
| IsList (ZipList a) | |||||
| Read a => Read (ZipList a) | |||||
Defined in GHC.Internal.Functor.ZipList | |||||
| Show a => Show (ZipList a) | |||||
| Eq a => Eq (ZipList a) | |||||
| Ord a => Ord (ZipList a) | |||||
Defined in GHC.Internal.Functor.ZipList | |||||
| type Rep1 ZipList | |||||
Defined in GHC.Internal.Functor.ZipList type Rep1 ZipList = D1 ('MetaData "ZipList" "GHC.Internal.Functor.ZipList" "ghc-internal" 'True) (C1 ('MetaCons "ZipList" 'PrefixI 'True) (S1 ('MetaSel ('Just "getZipList") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 []))) | |||||
| type Rep (ZipList a) | |||||
Defined in GHC.Internal.Functor.ZipList type Rep (ZipList a) = D1 ('MetaData "ZipList" "GHC.Internal.Functor.ZipList" "ghc-internal" 'True) (C1 ('MetaCons "ZipList" 'PrefixI 'True) (S1 ('MetaSel ('Just "getZipList") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [a]))) | |||||
| type Item (ZipList a) | |||||
Defined in GHC.Internal.IsList type Item (ZipList a) = a | |||||
Instances
| NFData Any | |||||
Defined in Control.DeepSeq | |||||
| Monoid Any | |||||
| Semigroup Any | |||||
| Bounded Any | |||||
Defined in GHC.Internal.Data.Semigroup.Internal | |||||
| Generic Any | |||||
Defined in GHC.Internal.Data.Semigroup.Internal Associated Types
| |||||
| Read Any | |||||
Defined in GHC.Internal.Data.Semigroup.Internal | |||||
| Show Any | |||||
| Eq Any | |||||
| Ord Any | |||||
| type Rep Any | |||||
Defined in GHC.Internal.Data.Semigroup.Internal type Rep Any = D1 ('MetaData "Any" "GHC.Internal.Data.Semigroup.Internal" "ghc-internal" 'True) (C1 ('MetaCons "Any" 'PrefixI 'True) (S1 ('MetaSel ('Just "getAny") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool))) | |||||
Instances
| Semigroup ByteArray | |
| Semigroup Builder | |
| Semigroup ByteString | |
| Semigroup ByteString | |
| Semigroup ShortByteString | |
| Semigroup IntSet | |
| Semigroup Void | |
| Semigroup All | |
| Semigroup Any | |
| Semigroup ExceptionContext | |
| Semigroup Ordering | |
| Semigroup OsString | |
| Semigroup PosixString | |
| Semigroup WindowsString | |
| Semigroup Doc | |
| Semigroup Text | |
| Semigroup Text | |
| Semigroup () | |
| Semigroup (FromMaybe b) | |
| Semigroup a => Semigroup (JoinWith a) | |
| Semigroup (NonEmptyDList a) | |
| Semigroup (Comparison a) | |
| Semigroup (Equivalence a) | |
| Semigroup (Predicate a) | |
| Semigroup (First a) | |
| Semigroup (Last a) | |
| Ord a => Semigroup (Max a) | |
| Ord a => Semigroup (Min a) | |
| Monoid m => Semigroup (WrappedMonoid m) | |
Defined in Data.Semigroup Methods (<>) :: WrappedMonoid m -> WrappedMonoid m -> WrappedMonoid m # sconcat :: NonEmpty (WrappedMonoid m) -> WrappedMonoid m # stimes :: Integral b => b -> WrappedMonoid m -> WrappedMonoid m # | |
| Semigroup (IntMap a) | |
| Semigroup (Seq a) | |
| Ord a => Semigroup (Intersection a) | |
| Semigroup (MergeSet a) | |
| Ord a => Semigroup (Set a) | |
| Semigroup (NonEmpty a) | |
| Semigroup a => Semigroup (STM a) | |
| Semigroup a => Semigroup (Identity a) | |
| Semigroup a => Semigroup (Down a) | |
| Semigroup a => Semigroup (Dual a) | |
| Semigroup (Endo a) | |
| Num a => Semigroup (Product a) | |
| Num a => Semigroup (Sum a) | |
| (Generic a, Semigroup (Rep a ())) => Semigroup (Generically a) | |
| Semigroup p => Semigroup (Par1 p) | |
| Semigroup a => Semigroup (IO a) | |
| Ord a => Semigroup (MaxQueue a) | |
| Semigroup (Doc a) | |
| Semigroup a => Semigroup (Behavior a) Source # | |
| Semigroup a => Semigroup (Event a) Source # | The combinator (<>) :: Event a -> Event a -> Event a (<>) ex ey = unionWith (<>) ex ey |
| Semigroup a => Semigroup (Moment a) Source # | |
| Semigroup a => Semigroup (MomentIO a) Source # | |
| (Generic a, GSemigroup (Rep a)) => Semigroup (GenericSemigroupMonoid a) | |
Defined in Data.Semigroup.Generic Methods (<>) :: GenericSemigroupMonoid a -> GenericSemigroupMonoid a -> GenericSemigroupMonoid a # sconcat :: NonEmpty (GenericSemigroupMonoid a) -> GenericSemigroupMonoid a # stimes :: Integral b => b -> GenericSemigroupMonoid a -> GenericSemigroupMonoid a # | |
| Semigroup a => Semigroup (Q a) | |
| Semigroup (Validity k) | |
| (Hashable a, Eq a) => Semigroup (HashSet a) | \(O(n+m)\) To obtain good performance, the smaller set must be presented as the first argument. Examples
|
| Semigroup (Vault s) | |
| Semigroup (Vault s) | |
| Semigroup a => Semigroup (Maybe a) | |
| Semigroup a => Semigroup (Solo a) | |
| Semigroup [a] | |
| Semigroup a => Semigroup (Op a b) | |
| Ord k => Semigroup (Map k v) | |
| Semigroup (Either a b) | |
| Semigroup (U1 p) | |
| Semigroup (V1 p) | |
| Ord k => Semigroup (MinPQueue k a) | |
| (Semigroup a, Semigroup b) => Semigroup (These a b) | |
| (Eq k, Hashable k) => Semigroup (HashMap k v) | If a key occurs in both maps, the mapping from the first will be the mapping in the result. Examples
|
| (Semigroup a, Semigroup b) => Semigroup (a, b) | |
| Semigroup b => Semigroup (a -> b) | |
| Semigroup a => Semigroup (Const a b) | |
| Alternative f => Semigroup (Alt f a) | |
| Semigroup (f p) => Semigroup (Rec1 f p) | |
| Semigroup a => Semigroup (Constant a b) | |
| (Semigroup a, Semigroup b, Semigroup c) => Semigroup (a, b, c) | |
| (Semigroup (f a), Semigroup (g a)) => Semigroup (Product f g a) | |
| (Semigroup (f p), Semigroup (g p)) => Semigroup ((f :*: g) p) | |
| Semigroup c => Semigroup (K1 i c p) | |
| (Semigroup a, Semigroup b, Semigroup c, Semigroup d) => Semigroup (a, b, c, d) | |
| Semigroup (f (g a)) => Semigroup (Compose f g a) | |
| Semigroup (f (g p)) => Semigroup ((f :.: g) p) | |
| Semigroup (f p) => Semigroup (M1 i c f p) | |
| (Semigroup a, Semigroup b, Semigroup c, Semigroup d, Semigroup e) => Semigroup (a, b, c, d, e) | |
Instances
| Foldable1 Min | |||||
Defined in Data.Foldable1 Methods fold1 :: Semigroup m => Min m -> m foldMap1 :: Semigroup m => (a -> m) -> Min a -> m foldMap1' :: Semigroup m => (a -> m) -> Min a -> m toNonEmpty :: Min a -> NonEmpty a maximum :: Ord a => Min a -> a minimum :: Ord a => Min a -> a foldrMap1 :: (a -> b) -> (a -> b -> b) -> Min a -> b foldlMap1' :: (a -> b) -> (b -> a -> b) -> Min a -> b foldlMap1 :: (a -> b) -> (b -> a -> b) -> Min a -> b foldrMap1' :: (a -> b) -> (a -> b -> b) -> Min a -> b | |||||
| NFData1 Min | |||||
Defined in Control.DeepSeq | |||||
| Applicative Min | |||||
| Functor Min | |||||
| Monad Min | |||||
| MonadFix Min | |||||
Defined in Data.Semigroup | |||||
| Foldable Min | |||||
Defined in Data.Semigroup Methods fold :: Monoid m => Min m -> m foldMap :: Monoid m => (a -> m) -> Min a -> m foldMap' :: Monoid m => (a -> m) -> Min a -> m foldr :: (a -> b -> b) -> b -> Min a -> b foldr' :: (a -> b -> b) -> b -> Min a -> b foldl :: (b -> a -> b) -> b -> Min a -> b foldl' :: (b -> a -> b) -> b -> Min a -> b foldr1 :: (a -> a -> a) -> Min a -> a foldl1 :: (a -> a -> a) -> Min a -> a elem :: Eq a => a -> Min a -> Bool maximum :: Ord a => Min a -> a | |||||
| Traversable Min | |||||
Defined in Data.Semigroup | |||||
| Generic1 Min | |||||
Defined in Data.Semigroup Associated Types
| |||||
| NFData a => NFData (Min a) | |||||
Defined in Control.DeepSeq | |||||
| (Ord a, Bounded a) => Monoid (Min a) | |||||
| Ord a => Semigroup (Min a) | |||||
| Data a => Data (Min a) | |||||
Defined in Data.Semigroup Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Min a -> c (Min a) gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Min a) dataTypeOf :: Min a -> DataType dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Min a)) dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Min a)) gmapT :: (forall b. Data b => b -> b) -> Min a -> Min a gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Min a -> r gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Min a -> r gmapQ :: (forall d. Data d => d -> u) -> Min a -> [u] gmapQi :: Int -> (forall d. Data d => d -> u) -> Min a -> u gmapM :: Monad m => (forall d. Data d => d -> m d) -> Min a -> m (Min a) gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Min a -> m (Min a) gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Min a -> m (Min a) | |||||
| Bounded a => Bounded (Min a) | |||||
Defined in Data.Semigroup | |||||
| Enum a => Enum (Min a) | |||||
| Generic (Min a) | |||||
Defined in Data.Semigroup Associated Types
| |||||
| Num a => Num (Min a) | |||||
| Read a => Read (Min a) | |||||
Defined in Data.Semigroup | |||||
| Show a => Show (Min a) | |||||
| Eq a => Eq (Min a) | |||||
| Ord a => Ord (Min a) | |||||
| Hashable a => Hashable (Min a) | |||||
Defined in Data.Hashable.Class | |||||
| type Rep1 Min | |||||
Defined in Data.Semigroup type Rep1 Min = D1 ('MetaData "Min" "Data.Semigroup" "base" 'True) (C1 ('MetaCons "Min" 'PrefixI 'True) (S1 ('MetaSel ('Just "getMin") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1)) | |||||
| type Rep (Min a) | |||||
Defined in Data.Semigroup type Rep (Min a) = D1 ('MetaData "Min" "Data.Semigroup" "base" 'True) (C1 ('MetaCons "Min" 'PrefixI 'True) (S1 ('MetaSel ('Just "getMin") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a))) | |||||
Instances
| Foldable1 Max | |||||
Defined in Data.Foldable1 Methods fold1 :: Semigroup m => Max m -> m foldMap1 :: Semigroup m => (a -> m) -> Max a -> m foldMap1' :: Semigroup m => (a -> m) -> Max a -> m toNonEmpty :: Max a -> NonEmpty a maximum :: Ord a => Max a -> a minimum :: Ord a => Max a -> a foldrMap1 :: (a -> b) -> (a -> b -> b) -> Max a -> b foldlMap1' :: (a -> b) -> (b -> a -> b) -> Max a -> b foldlMap1 :: (a -> b) -> (b -> a -> b) -> Max a -> b foldrMap1' :: (a -> b) -> (a -> b -> b) -> Max a -> b | |||||
| NFData1 Max | |||||
Defined in Control.DeepSeq | |||||
| Applicative Max | |||||
| Functor Max | |||||
| Monad Max | |||||
| MonadFix Max | |||||
Defined in Data.Semigroup | |||||
| Foldable Max | |||||
Defined in Data.Semigroup Methods fold :: Monoid m => Max m -> m foldMap :: Monoid m => (a -> m) -> Max a -> m foldMap' :: Monoid m => (a -> m) -> Max a -> m foldr :: (a -> b -> b) -> b -> Max a -> b foldr' :: (a -> b -> b) -> b -> Max a -> b foldl :: (b -> a -> b) -> b -> Max a -> b foldl' :: (b -> a -> b) -> b -> Max a -> b foldr1 :: (a -> a -> a) -> Max a -> a foldl1 :: (a -> a -> a) -> Max a -> a elem :: Eq a => a -> Max a -> Bool maximum :: Ord a => Max a -> a | |||||
| Traversable Max | |||||
Defined in Data.Semigroup | |||||
| Generic1 Max | |||||
Defined in Data.Semigroup Associated Types
| |||||
| NFData a => NFData (Max a) | |||||
Defined in Control.DeepSeq | |||||
| (Ord a, Bounded a) => Monoid (Max a) | |||||
| Ord a => Semigroup (Max a) | |||||
| Data a => Data (Max a) | |||||
Defined in Data.Semigroup Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Max a -> c (Max a) gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Max a) dataTypeOf :: Max a -> DataType dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Max a)) dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Max a)) gmapT :: (forall b. Data b => b -> b) -> Max a -> Max a gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Max a -> r gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Max a -> r gmapQ :: (forall d. Data d => d -> u) -> Max a -> [u] gmapQi :: Int -> (forall d. Data d => d -> u) -> Max a -> u gmapM :: Monad m => (forall d. Data d => d -> m d) -> Max a -> m (Max a) gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Max a -> m (Max a) gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Max a -> m (Max a) | |||||
| Bounded a => Bounded (Max a) | |||||
Defined in Data.Semigroup | |||||
| Enum a => Enum (Max a) | |||||
| Generic (Max a) | |||||
Defined in Data.Semigroup Associated Types
| |||||
| Num a => Num (Max a) | |||||
| Read a => Read (Max a) | |||||
Defined in Data.Semigroup | |||||
| Show a => Show (Max a) | |||||
| Eq a => Eq (Max a) | |||||
| Ord a => Ord (Max a) | |||||
| Hashable a => Hashable (Max a) | |||||
Defined in Data.Hashable.Class | |||||
| type Rep1 Max | |||||
Defined in Data.Semigroup type Rep1 Max = D1 ('MetaData "Max" "Data.Semigroup" "base" 'True) (C1 ('MetaCons "Max" 'PrefixI 'True) (S1 ('MetaSel ('Just "getMax") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1)) | |||||
| type Rep (Max a) | |||||
Defined in Data.Semigroup type Rep (Max a) = D1 ('MetaData "Max" "Data.Semigroup" "base" 'True) (C1 ('MetaCons "Max" 'PrefixI 'True) (S1 ('MetaSel ('Just "getMax") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a))) | |||||
Constructors
| Arg a b |
Instances
| Bifoldable Arg | |||||
| Bifoldable1 Arg | |||||
Defined in Data.Bifoldable1 | |||||
| Bifunctor Arg | |||||
| Bitraversable Arg | |||||
Defined in Data.Semigroup Methods bitraverse :: Applicative f => (a -> f c) -> (b -> f d) -> Arg a b -> f (Arg c d) | |||||
| NFData2 Arg | |||||
Defined in Control.DeepSeq | |||||
| Generic1 (Arg a :: Type -> Type) | |||||
Defined in Data.Semigroup Associated Types
| |||||
| NFData a => NFData1 (Arg a) | |||||
Defined in Control.DeepSeq | |||||
| Functor (Arg a) | |||||
| Foldable (Arg a) | |||||
Defined in Data.Semigroup Methods fold :: Monoid m => Arg a m -> m foldMap :: Monoid m => (a0 -> m) -> Arg a a0 -> m foldMap' :: Monoid m => (a0 -> m) -> Arg a a0 -> m foldr :: (a0 -> b -> b) -> b -> Arg a a0 -> b foldr' :: (a0 -> b -> b) -> b -> Arg a a0 -> b foldl :: (b -> a0 -> b) -> b -> Arg a a0 -> b foldl' :: (b -> a0 -> b) -> b -> Arg a a0 -> b foldr1 :: (a0 -> a0 -> a0) -> Arg a a0 -> a0 foldl1 :: (a0 -> a0 -> a0) -> Arg a a0 -> a0 elem :: Eq a0 => a0 -> Arg a a0 -> Bool maximum :: Ord a0 => Arg a a0 -> a0 minimum :: Ord a0 => Arg a a0 -> a0 | |||||
| Traversable (Arg a) | |||||
Defined in Data.Semigroup | |||||
| (NFData a, NFData b) => NFData (Arg a b) | |||||
Defined in Control.DeepSeq | |||||
| (Data a, Data b) => Data (Arg a b) | |||||
Defined in Data.Semigroup Methods gfoldl :: (forall d b0. Data d => c (d -> b0) -> d -> c b0) -> (forall g. g -> c g) -> Arg a b -> c (Arg a b) gunfold :: (forall b0 r. Data b0 => c (b0 -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Arg a b) dataTypeOf :: Arg a b -> DataType dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Arg a b)) dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Arg a b)) gmapT :: (forall b0. Data b0 => b0 -> b0) -> Arg a b -> Arg a b gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Arg a b -> r gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Arg a b -> r gmapQ :: (forall d. Data d => d -> u) -> Arg a b -> [u] gmapQi :: Int -> (forall d. Data d => d -> u) -> Arg a b -> u gmapM :: Monad m => (forall d. Data d => d -> m d) -> Arg a b -> m (Arg a b) gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Arg a b -> m (Arg a b) gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Arg a b -> m (Arg a b) | |||||
| Generic (Arg a b) | |||||
Defined in Data.Semigroup Associated Types
| |||||
| (Read a, Read b) => Read (Arg a b) | |||||
Defined in Data.Semigroup | |||||
| (Show a, Show b) => Show (Arg a b) | |||||
| Eq a => Eq (Arg a b) | |||||
| Ord a => Ord (Arg a b) | |||||
| Hashable a => Hashable (Arg a b) | Note: Prior to Since Since: hashable-1.3.0.0 | ||||
Defined in Data.Hashable.Class | |||||
| type Rep1 (Arg a :: Type -> Type) | |||||
Defined in Data.Semigroup type Rep1 (Arg a :: Type -> Type) = D1 ('MetaData "Arg" "Data.Semigroup" "base" 'False) (C1 ('MetaCons "Arg" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1)) | |||||
| type Rep (Arg a b) | |||||
Defined in Data.Semigroup type Rep (Arg a b) = D1 ('MetaData "Arg" "Data.Semigroup" "base" 'False) (C1 ('MetaCons "Arg" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 b))) | |||||
Instances
| Foldable1 First | |||||
Defined in Data.Foldable1 Methods fold1 :: Semigroup m => First m -> m foldMap1 :: Semigroup m => (a -> m) -> First a -> m foldMap1' :: Semigroup m => (a -> m) -> First a -> m toNonEmpty :: First a -> NonEmpty a maximum :: Ord a => First a -> a minimum :: Ord a => First a -> a foldrMap1 :: (a -> b) -> (a -> b -> b) -> First a -> b foldlMap1' :: (a -> b) -> (b -> a -> b) -> First a -> b foldlMap1 :: (a -> b) -> (b -> a -> b) -> First a -> b foldrMap1' :: (a -> b) -> (a -> b -> b) -> First a -> b | |||||
| NFData1 First | |||||
Defined in Control.DeepSeq | |||||
| Applicative First | |||||
| Functor First | |||||
| Monad First | |||||
| MonadFix First | |||||
Defined in Data.Semigroup | |||||
| Foldable First | |||||
Defined in Data.Semigroup Methods fold :: Monoid m => First m -> m foldMap :: Monoid m => (a -> m) -> First a -> m foldMap' :: Monoid m => (a -> m) -> First a -> m foldr :: (a -> b -> b) -> b -> First a -> b foldr' :: (a -> b -> b) -> b -> First a -> b foldl :: (b -> a -> b) -> b -> First a -> b foldl' :: (b -> a -> b) -> b -> First a -> b foldr1 :: (a -> a -> a) -> First a -> a foldl1 :: (a -> a -> a) -> First a -> a elem :: Eq a => a -> First a -> Bool maximum :: Ord a => First a -> a | |||||
| Traversable First | |||||
Defined in Data.Semigroup | |||||
| Generic1 First | |||||
Defined in Data.Semigroup Associated Types
| |||||
| NFData a => NFData (First a) | |||||
Defined in Control.DeepSeq | |||||
| Semigroup (First a) | |||||
| Data a => Data (First a) | |||||
Defined in Data.Semigroup Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> First a -> c (First a) gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (First a) dataTypeOf :: First a -> DataType dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (First a)) dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (First a)) gmapT :: (forall b. Data b => b -> b) -> First a -> First a gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> First a -> r gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> First a -> r gmapQ :: (forall d. Data d => d -> u) -> First a -> [u] gmapQi :: Int -> (forall d. Data d => d -> u) -> First a -> u gmapM :: Monad m => (forall d. Data d => d -> m d) -> First a -> m (First a) gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> First a -> m (First a) gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> First a -> m (First a) | |||||
| Bounded a => Bounded (First a) | |||||
Defined in Data.Semigroup | |||||
| Enum a => Enum (First a) | |||||
Defined in Data.Semigroup | |||||
| Generic (First a) | |||||
Defined in Data.Semigroup Associated Types
| |||||
| Read a => Read (First a) | |||||
Defined in Data.Semigroup | |||||
| Show a => Show (First a) | |||||
| Eq a => Eq (First a) | |||||
| Ord a => Ord (First a) | |||||
| Hashable a => Hashable (First a) | |||||
Defined in Data.Hashable.Class | |||||
| type Rep1 First | |||||
Defined in Data.Semigroup type Rep1 First = D1 ('MetaData "First" "Data.Semigroup" "base" 'True) (C1 ('MetaCons "First" 'PrefixI 'True) (S1 ('MetaSel ('Just "getFirst") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1)) | |||||
| type Rep (First a) | |||||
Defined in Data.Semigroup type Rep (First a) = D1 ('MetaData "First" "Data.Semigroup" "base" 'True) (C1 ('MetaCons "First" 'PrefixI 'True) (S1 ('MetaSel ('Just "getFirst") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a))) | |||||
Instances
| Foldable1 Last | |||||
Defined in Data.Foldable1 Methods fold1 :: Semigroup m => Last m -> m foldMap1 :: Semigroup m => (a -> m) -> Last a -> m foldMap1' :: Semigroup m => (a -> m) -> Last a -> m toNonEmpty :: Last a -> NonEmpty a maximum :: Ord a => Last a -> a minimum :: Ord a => Last a -> a foldrMap1 :: (a -> b) -> (a -> b -> b) -> Last a -> b foldlMap1' :: (a -> b) -> (b -> a -> b) -> Last a -> b foldlMap1 :: (a -> b) -> (b -> a -> b) -> Last a -> b foldrMap1' :: (a -> b) -> (a -> b -> b) -> Last a -> b | |||||
| NFData1 Last | |||||
Defined in Control.DeepSeq | |||||
| Applicative Last | |||||
| Functor Last | |||||
| Monad Last | |||||
| MonadFix Last | |||||
Defined in Data.Semigroup | |||||
| Foldable Last | |||||
Defined in Data.Semigroup Methods fold :: Monoid m => Last m -> m foldMap :: Monoid m => (a -> m) -> Last a -> m foldMap' :: Monoid m => (a -> m) -> Last a -> m foldr :: (a -> b -> b) -> b -> Last a -> b foldr' :: (a -> b -> b) -> b -> Last a -> b foldl :: (b -> a -> b) -> b -> Last a -> b foldl' :: (b -> a -> b) -> b -> Last a -> b foldr1 :: (a -> a -> a) -> Last a -> a foldl1 :: (a -> a -> a) -> Last a -> a elem :: Eq a => a -> Last a -> Bool maximum :: Ord a => Last a -> a | |||||
| Traversable Last | |||||
Defined in Data.Semigroup | |||||
| Generic1 Last | |||||
Defined in Data.Semigroup Associated Types
| |||||
| NFData a => NFData (Last a) | |||||
Defined in Control.DeepSeq | |||||
| Semigroup (Last a) | |||||
| Data a => Data (Last a) | |||||
Defined in Data.Semigroup Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Last a -> c (Last a) gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Last a) dataTypeOf :: Last a -> DataType dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Last a)) dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Last a)) gmapT :: (forall b. Data b => b -> b) -> Last a -> Last a gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Last a -> r gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Last a -> r gmapQ :: (forall d. Data d => d -> u) -> Last a -> [u] gmapQi :: Int -> (forall d. Data d => d -> u) -> Last a -> u gmapM :: Monad m => (forall d. Data d => d -> m d) -> Last a -> m (Last a) gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Last a -> m (Last a) gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Last a -> m (Last a) | |||||
| Bounded a => Bounded (Last a) | |||||
Defined in Data.Semigroup | |||||
| Enum a => Enum (Last a) | |||||
Defined in Data.Semigroup | |||||
| Generic (Last a) | |||||
Defined in Data.Semigroup Associated Types
| |||||
| Read a => Read (Last a) | |||||
Defined in Data.Semigroup | |||||
| Show a => Show (Last a) | |||||
| Eq a => Eq (Last a) | |||||
| Ord a => Ord (Last a) | |||||
| Hashable a => Hashable (Last a) | |||||
Defined in Data.Hashable.Class | |||||
| type Rep1 Last | |||||
Defined in Data.Semigroup type Rep1 Last = D1 ('MetaData "Last" "Data.Semigroup" "base" 'True) (C1 ('MetaCons "Last" 'PrefixI 'True) (S1 ('MetaSel ('Just "getLast") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1)) | |||||
| type Rep (Last a) | |||||
Defined in Data.Semigroup type Rep (Last a) = D1 ('MetaData "Last" "Data.Semigroup" "base" 'True) (C1 ('MetaCons "Last" 'PrefixI 'True) (S1 ('MetaSel ('Just "getLast") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a))) | |||||
Instances
| NFData All | |||||
Defined in Control.DeepSeq | |||||
| Monoid All | |||||
| Semigroup All | |||||
| Bounded All | |||||
Defined in GHC.Internal.Data.Semigroup.Internal | |||||
| Generic All | |||||
Defined in GHC.Internal.Data.Semigroup.Internal Associated Types
| |||||
| Read All | |||||
Defined in GHC.Internal.Data.Semigroup.Internal | |||||
| Show All | |||||
| Eq All | |||||
| Ord All | |||||
| type Rep All | |||||
Defined in GHC.Internal.Data.Semigroup.Internal type Rep All = D1 ('MetaData "All" "GHC.Internal.Data.Semigroup.Internal" "ghc-internal" 'True) (C1 ('MetaCons "All" 'PrefixI 'True) (S1 ('MetaSel ('Just "getAll") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool))) | |||||
Instances
| MonadZip Dual | |||||
| Foldable1 Dual | |||||
Defined in Data.Foldable1 Methods fold1 :: Semigroup m => Dual m -> m foldMap1 :: Semigroup m => (a -> m) -> Dual a -> m foldMap1' :: Semigroup m => (a -> m) -> Dual a -> m toNonEmpty :: Dual a -> NonEmpty a maximum :: Ord a => Dual a -> a minimum :: Ord a => Dual a -> a foldrMap1 :: (a -> b) -> (a -> b -> b) -> Dual a -> b foldlMap1' :: (a -> b) -> (b -> a -> b) -> Dual a -> b foldlMap1 :: (a -> b) -> (b -> a -> b) -> Dual a -> b foldrMap1' :: (a -> b) -> (a -> b -> b) -> Dual a -> b | |||||
| NFData1 Dual | |||||
Defined in Control.DeepSeq | |||||
| Applicative Dual | |||||
| Functor Dual | |||||
| Monad Dual | |||||
| MonadFix Dual | |||||
Defined in GHC.Internal.Control.Monad.Fix | |||||
| Foldable Dual | |||||
Defined in GHC.Internal.Data.Foldable Methods fold :: Monoid m => Dual m -> m foldMap :: Monoid m => (a -> m) -> Dual a -> m foldMap' :: Monoid m => (a -> m) -> Dual a -> m foldr :: (a -> b -> b) -> b -> Dual a -> b foldr' :: (a -> b -> b) -> b -> Dual a -> b foldl :: (b -> a -> b) -> b -> Dual a -> b foldl' :: (b -> a -> b) -> b -> Dual a -> b foldr1 :: (a -> a -> a) -> Dual a -> a foldl1 :: (a -> a -> a) -> Dual a -> a elem :: Eq a => a -> Dual a -> Bool maximum :: Ord a => Dual a -> a | |||||
| Traversable Dual | |||||
Defined in GHC.Internal.Data.Traversable | |||||
| Generic1 Dual | |||||
Defined in GHC.Internal.Data.Semigroup.Internal Associated Types
| |||||
| NFData a => NFData (Dual a) | |||||
Defined in Control.DeepSeq | |||||
| Monoid a => Monoid (Dual a) | |||||
| Semigroup a => Semigroup (Dual a) | |||||
| Bounded a => Bounded (Dual a) | |||||
Defined in GHC.Internal.Data.Semigroup.Internal | |||||
| Generic (Dual a) | |||||
Defined in GHC.Internal.Data.Semigroup.Internal Associated Types
| |||||
| Read a => Read (Dual a) | |||||
Defined in GHC.Internal.Data.Semigroup.Internal | |||||
| Show a => Show (Dual a) | |||||
| Eq a => Eq (Dual a) | |||||
| Ord a => Ord (Dual a) | |||||
| type Rep1 Dual | |||||
Defined in GHC.Internal.Data.Semigroup.Internal type Rep1 Dual = D1 ('MetaData "Dual" "GHC.Internal.Data.Semigroup.Internal" "ghc-internal" 'True) (C1 ('MetaCons "Dual" 'PrefixI 'True) (S1 ('MetaSel ('Just "getDual") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1)) | |||||
| type Rep (Dual a) | |||||
Defined in GHC.Internal.Data.Semigroup.Internal type Rep (Dual a) = D1 ('MetaData "Dual" "GHC.Internal.Data.Semigroup.Internal" "ghc-internal" 'True) (C1 ('MetaCons "Dual" 'PrefixI 'True) (S1 ('MetaSel ('Just "getDual") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a))) | |||||
Instances
| Monoid (Endo a) | |||||
| Semigroup (Endo a) | |||||
| Generic (Endo a) | |||||
Defined in GHC.Internal.Data.Semigroup.Internal Associated Types
| |||||
| type Rep (Endo a) | |||||
Defined in GHC.Internal.Data.Semigroup.Internal type Rep (Endo a) = D1 ('MetaData "Endo" "GHC.Internal.Data.Semigroup.Internal" "ghc-internal" 'True) (C1 ('MetaCons "Endo" 'PrefixI 'True) (S1 ('MetaSel ('Just "appEndo") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (a -> a)))) | |||||
Constructors
| Product | |
Fields
| |
Instances
| MonadZip Product | |||||
| Foldable1 Product | |||||
Defined in Data.Foldable1 Methods fold1 :: Semigroup m => Product m -> m foldMap1 :: Semigroup m => (a -> m) -> Product a -> m foldMap1' :: Semigroup m => (a -> m) -> Product a -> m toNonEmpty :: Product a -> NonEmpty a maximum :: Ord a => Product a -> a minimum :: Ord a => Product a -> a foldrMap1 :: (a -> b) -> (a -> b -> b) -> Product a -> b foldlMap1' :: (a -> b) -> (b -> a -> b) -> Product a -> b foldlMap1 :: (a -> b) -> (b -> a -> b) -> Product a -> b foldrMap1' :: (a -> b) -> (a -> b -> b) -> Product a -> b | |||||
| NFData1 Product | |||||
Defined in Control.DeepSeq | |||||
| Applicative Product | |||||
| Functor Product | |||||
| Monad Product | |||||
| MonadFix Product | |||||
Defined in GHC.Internal.Control.Monad.Fix | |||||
| Foldable Product | |||||
Defined in GHC.Internal.Data.Foldable Methods fold :: Monoid m => Product m -> m foldMap :: Monoid m => (a -> m) -> Product a -> m foldMap' :: Monoid m => (a -> m) -> Product a -> m foldr :: (a -> b -> b) -> b -> Product a -> b foldr' :: (a -> b -> b) -> b -> Product a -> b foldl :: (b -> a -> b) -> b -> Product a -> b foldl' :: (b -> a -> b) -> b -> Product a -> b foldr1 :: (a -> a -> a) -> Product a -> a foldl1 :: (a -> a -> a) -> Product a -> a elem :: Eq a => a -> Product a -> Bool maximum :: Ord a => Product a -> a minimum :: Ord a => Product a -> a | |||||
| Traversable Product | |||||
Defined in GHC.Internal.Data.Traversable | |||||
| Generic1 Product | |||||
Defined in GHC.Internal.Data.Semigroup.Internal Associated Types
| |||||
| NFData a => NFData (Product a) | |||||
Defined in Control.DeepSeq | |||||
| Num a => Monoid (Product a) | |||||
| Num a => Semigroup (Product a) | |||||
| Bounded a => Bounded (Product a) | |||||
Defined in GHC.Internal.Data.Semigroup.Internal | |||||
| Generic (Product a) | |||||
Defined in GHC.Internal.Data.Semigroup.Internal Associated Types
| |||||
| Num a => Num (Product a) | |||||
Defined in GHC.Internal.Data.Semigroup.Internal | |||||
| Read a => Read (Product a) | |||||
Defined in GHC.Internal.Data.Semigroup.Internal | |||||
| Show a => Show (Product a) | |||||
| Eq a => Eq (Product a) | |||||
| Ord a => Ord (Product a) | |||||
Defined in GHC.Internal.Data.Semigroup.Internal | |||||
| type Rep1 Product | |||||
Defined in GHC.Internal.Data.Semigroup.Internal type Rep1 Product = D1 ('MetaData "Product" "GHC.Internal.Data.Semigroup.Internal" "ghc-internal" 'True) (C1 ('MetaCons "Product" 'PrefixI 'True) (S1 ('MetaSel ('Just "getProduct") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1)) | |||||
| type Rep (Product a) | |||||
Defined in GHC.Internal.Data.Semigroup.Internal type Rep (Product a) = D1 ('MetaData "Product" "GHC.Internal.Data.Semigroup.Internal" "ghc-internal" 'True) (C1 ('MetaCons "Product" 'PrefixI 'True) (S1 ('MetaSel ('Just "getProduct") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a))) | |||||
Instances
| MonadZip Sum | |||||
| Foldable1 Sum | |||||
Defined in Data.Foldable1 Methods fold1 :: Semigroup m => Sum m -> m foldMap1 :: Semigroup m => (a -> m) -> Sum a -> m foldMap1' :: Semigroup m => (a -> m) -> Sum a -> m toNonEmpty :: Sum a -> NonEmpty a maximum :: Ord a => Sum a -> a minimum :: Ord a => Sum a -> a foldrMap1 :: (a -> b) -> (a -> b -> b) -> Sum a -> b foldlMap1' :: (a -> b) -> (b -> a -> b) -> Sum a -> b foldlMap1 :: (a -> b) -> (b -> a -> b) -> Sum a -> b foldrMap1' :: (a -> b) -> (a -> b -> b) -> Sum a -> b | |||||
| NFData1 Sum | |||||
Defined in Control.DeepSeq | |||||
| Applicative Sum | |||||
| Functor Sum | |||||
| Monad Sum | |||||
| MonadFix Sum | |||||
Defined in GHC.Internal.Control.Monad.Fix | |||||
| Foldable Sum | |||||
Defined in GHC.Internal.Data.Foldable Methods fold :: Monoid m => Sum m -> m foldMap :: Monoid m => (a -> m) -> Sum a -> m foldMap' :: Monoid m => (a -> m) -> Sum a -> m foldr :: (a -> b -> b) -> b -> Sum a -> b foldr' :: (a -> b -> b) -> b -> Sum a -> b foldl :: (b -> a -> b) -> b -> Sum a -> b foldl' :: (b -> a -> b) -> b -> Sum a -> b foldr1 :: (a -> a -> a) -> Sum a -> a foldl1 :: (a -> a -> a) -> Sum a -> a elem :: Eq a => a -> Sum a -> Bool maximum :: Ord a => Sum a -> a | |||||
| Traversable Sum | |||||
Defined in GHC.Internal.Data.Traversable | |||||
| Generic1 Sum | |||||
Defined in GHC.Internal.Data.Semigroup.Internal Associated Types
| |||||
| NFData a => NFData (Sum a) | |||||
Defined in Control.DeepSeq | |||||
| Num a => Monoid (Sum a) | |||||
| Num a => Semigroup (Sum a) | |||||
| Bounded a => Bounded (Sum a) | |||||
Defined in GHC.Internal.Data.Semigroup.Internal | |||||
| Generic (Sum a) | |||||
Defined in GHC.Internal.Data.Semigroup.Internal Associated Types
| |||||
| Num a => Num (Sum a) | |||||
| Read a => Read (Sum a) | |||||
Defined in GHC.Internal.Data.Semigroup.Internal | |||||
| Show a => Show (Sum a) | |||||
| Eq a => Eq (Sum a) | |||||
| Ord a => Ord (Sum a) | |||||
| type Rep1 Sum | |||||
Defined in GHC.Internal.Data.Semigroup.Internal type Rep1 Sum = D1 ('MetaData "Sum" "GHC.Internal.Data.Semigroup.Internal" "ghc-internal" 'True) (C1 ('MetaCons "Sum" 'PrefixI 'True) (S1 ('MetaSel ('Just "getSum") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1)) | |||||
| type Rep (Sum a) | |||||
Defined in GHC.Internal.Data.Semigroup.Internal type Rep (Sum a) = D1 ('MetaData "Sum" "GHC.Internal.Data.Semigroup.Internal" "ghc-internal" 'True) (C1 ('MetaCons "Sum" 'PrefixI 'True) (S1 ('MetaSel ('Just "getSum") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a))) | |||||
newtype WrappedMonoid m #
Constructors
| WrapMonoid | |
Fields
| |
Instances
| NFData1 WrappedMonoid | |||||
Defined in Control.DeepSeq Methods liftRnf :: (a -> ()) -> WrappedMonoid a -> () | |||||
| Generic1 WrappedMonoid | |||||
Defined in Data.Semigroup Associated Types
Methods from1 :: WrappedMonoid a -> Rep1 WrappedMonoid a to1 :: Rep1 WrappedMonoid a -> WrappedMonoid a | |||||
| NFData m => NFData (WrappedMonoid m) | |||||
Defined in Control.DeepSeq Methods rnf :: WrappedMonoid m -> () | |||||
| Monoid m => Monoid (WrappedMonoid m) | |||||
Defined in Data.Semigroup Methods mempty :: WrappedMonoid m mappend :: WrappedMonoid m -> WrappedMonoid m -> WrappedMonoid m mconcat :: [WrappedMonoid m] -> WrappedMonoid m | |||||
| Monoid m => Semigroup (WrappedMonoid m) | |||||
Defined in Data.Semigroup Methods (<>) :: WrappedMonoid m -> WrappedMonoid m -> WrappedMonoid m # sconcat :: NonEmpty (WrappedMonoid m) -> WrappedMonoid m # stimes :: Integral b => b -> WrappedMonoid m -> WrappedMonoid m # | |||||
| Data m => Data (WrappedMonoid m) | |||||
Defined in Data.Semigroup Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> WrappedMonoid m -> c (WrappedMonoid m) gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (WrappedMonoid m) toConstr :: WrappedMonoid m -> Constr dataTypeOf :: WrappedMonoid m -> DataType dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (WrappedMonoid m)) dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (WrappedMonoid m)) gmapT :: (forall b. Data b => b -> b) -> WrappedMonoid m -> WrappedMonoid m gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> WrappedMonoid m -> r gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> WrappedMonoid m -> r gmapQ :: (forall d. Data d => d -> u) -> WrappedMonoid m -> [u] gmapQi :: Int -> (forall d. Data d => d -> u) -> WrappedMonoid m -> u gmapM :: Monad m0 => (forall d. Data d => d -> m0 d) -> WrappedMonoid m -> m0 (WrappedMonoid m) gmapMp :: MonadPlus m0 => (forall d. Data d => d -> m0 d) -> WrappedMonoid m -> m0 (WrappedMonoid m) gmapMo :: MonadPlus m0 => (forall d. Data d => d -> m0 d) -> WrappedMonoid m -> m0 (WrappedMonoid m) | |||||
| Bounded m => Bounded (WrappedMonoid m) | |||||
Defined in Data.Semigroup | |||||
| Enum a => Enum (WrappedMonoid a) | |||||
Defined in Data.Semigroup Methods succ :: WrappedMonoid a -> WrappedMonoid a pred :: WrappedMonoid a -> WrappedMonoid a toEnum :: Int -> WrappedMonoid a fromEnum :: WrappedMonoid a -> Int enumFrom :: WrappedMonoid a -> [WrappedMonoid a] enumFromThen :: WrappedMonoid a -> WrappedMonoid a -> [WrappedMonoid a] enumFromTo :: WrappedMonoid a -> WrappedMonoid a -> [WrappedMonoid a] enumFromThenTo :: WrappedMonoid a -> WrappedMonoid a -> WrappedMonoid a -> [WrappedMonoid a] | |||||
| Generic (WrappedMonoid m) | |||||
Defined in Data.Semigroup Associated Types
Methods from :: WrappedMonoid m -> Rep (WrappedMonoid m) x to :: Rep (WrappedMonoid m) x -> WrappedMonoid m | |||||
| Read m => Read (WrappedMonoid m) | |||||
Defined in Data.Semigroup Methods readsPrec :: Int -> ReadS (WrappedMonoid m) readList :: ReadS [WrappedMonoid m] readPrec :: ReadPrec (WrappedMonoid m) readListPrec :: ReadPrec [WrappedMonoid m] | |||||
| Show m => Show (WrappedMonoid m) | |||||
Defined in Data.Semigroup Methods showsPrec :: Int -> WrappedMonoid m -> ShowS show :: WrappedMonoid m -> String showList :: [WrappedMonoid m] -> ShowS | |||||
| Eq m => Eq (WrappedMonoid m) | |||||
Defined in Data.Semigroup Methods (==) :: WrappedMonoid m -> WrappedMonoid m -> Bool (/=) :: WrappedMonoid m -> WrappedMonoid m -> Bool | |||||
| Ord m => Ord (WrappedMonoid m) | |||||
Defined in Data.Semigroup Methods compare :: WrappedMonoid m -> WrappedMonoid m -> Ordering (<) :: WrappedMonoid m -> WrappedMonoid m -> Bool (<=) :: WrappedMonoid m -> WrappedMonoid m -> Bool (>) :: WrappedMonoid m -> WrappedMonoid m -> Bool (>=) :: WrappedMonoid m -> WrappedMonoid m -> Bool max :: WrappedMonoid m -> WrappedMonoid m -> WrappedMonoid m min :: WrappedMonoid m -> WrappedMonoid m -> WrappedMonoid m | |||||
| Hashable a => Hashable (WrappedMonoid a) | |||||
Defined in Data.Hashable.Class Methods hashWithSalt :: Int -> WrappedMonoid a -> Int Source # hash :: WrappedMonoid a -> Int Source # | |||||
| type Rep1 WrappedMonoid | |||||
Defined in Data.Semigroup type Rep1 WrappedMonoid = D1 ('MetaData "WrappedMonoid" "Data.Semigroup" "base" 'True) (C1 ('MetaCons "WrapMonoid" 'PrefixI 'True) (S1 ('MetaSel ('Just "unwrapMonoid") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1)) | |||||
| type Rep (WrappedMonoid m) | |||||
Defined in Data.Semigroup type Rep (WrappedMonoid m) = D1 ('MetaData "WrappedMonoid" "Data.Semigroup" "base" 'True) (C1 ('MetaCons "WrapMonoid" 'PrefixI 'True) (S1 ('MetaSel ('Just "unwrapMonoid") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 m))) | |||||
stimesIdempotentMonoid :: (Integral b, Monoid a) => b -> a -> a #
stimesMonoid :: (Integral b, Monoid a) => b -> a -> a #
mtimesDefault :: (Integral b, Monoid a) => b -> a -> a #
stimesIdempotent :: Integral b => b -> a -> a #
unionWith :: (a -> a -> a) -> Event a -> Event a -> Event a Source #
Merge two event streams of the same type. The function argument specifies how event values are to be combined in case of a simultaneous occurrence. The semantics are
unionWith f ((timex,x):xs) ((timey,y):ys) | timex < timey = (timex,x) : unionWith f xs ((timey,y):ys) | timex > timey = (timey,y) : unionWith f ((timex,x):xs) ys | timex == timey = (timex,f x y) : unionWith f xs ys
filterE :: (a -> Bool) -> Event a -> Event a Source #
Allow all events that fulfill the predicate, discard the rest. Semantically,
filterE p es = [(time,a) | (time,a) <- es, p a]
apply :: Behavior (a -> b) -> Event a -> Event b Source #
Apply a time-varying function to a stream of events. Semantically,
apply bf ex = [(time, bf time x) | (time, x) <- ex]
This function is generally used in its infix variant <@>.
Moment and accumulation
The Moment monad denotes a pure computation that happens
at one particular moment in time. Semantically, it is a reader monad
type Moment a = Time -> a
When run, the argument tells the time at which this computation happens.
Note that in this context, time really means to logical time.
Of course, every calculation on a computer takes some
amount of wall-clock time to complete.
Instead, what is meant here is the time as it relates to
Events and Behaviors.
We use the fiction that every calculation within the Moment
monad takes zero logical time to perform.
Instances
| Applicative Moment Source # | |
| Functor Moment Source # | |
| Monad Moment Source # | |
| MonadFix Moment Source # | |
Defined in Reactive.Banana.Types | |
| MonadMoment Moment Source # | |
Defined in Reactive.Banana.Types Methods liftMoment :: Moment a -> Moment a Source # | |
| Monoid a => Monoid (Moment a) Source # | |
| Semigroup a => Semigroup (Moment a) Source # | |
class MonadFix m => MonadMoment (m :: Type -> Type) where Source #
An instance of the MonadMoment class denotes a computation
that happens at one particular moment in time.
Unlike the Moment monad, it need not be pure anymore.
Methods
liftMoment :: Moment a -> m a Source #
Instances
accumE :: MonadMoment m => a -> Event (a -> a) -> m (Event a) Source #
The accumE function accumulates a stream of event values,
similar to a strict left scan, scanl'.
It starts with an initial value and emits a new value
whenever an event occurrence happens.
The new value is calculated by applying the function in the event
to the old value.
Example:
accumE "x" [(time1,(++"y")),(time2,(++"z"))]
= trimE [(time1,"xy"),(time2,"xyz")]
where
trimE e start = [(time,x) | (time,x) <- e, start <= time]stepper :: MonadMoment m => a -> Event a -> m (Behavior a) Source #
Construct a time-varying function from an initial value and a stream of new values. The result will be a step function. Semantically,
stepper x0 ex = \time1 -> \time2 ->
last (x0 : [x | (timex,x) <- ex, time1 <= timex, timex < time2])Here is an illustration of the result Behavior at a particular time:

Note: The smaller-than-sign in the comparison timex < time2 means
that at time time2 == timex, the value of the Behavior will
still be the previous value.
In the illustration, this is indicated by the dots at the end
of each step.
This allows for recursive definitions.
See the discussion below for more on recursion.
Recursion
Recursion is a very important technique in FRP that is not apparent from the type signatures.
Here is a prototypical example. It shows how the accumE can be expressed
in terms of the stepper and apply functions by using recursion:
accumE a e1 = mdo let e2 = (\a f -> f a) <$> b <@> e1 b <- stepper a e2 return e2
(The mdo notation refers to value recursion in a monad.
The MonadFix instance for the Moment class enables this kind of recursive code.)
(Strictly speaking, this also means that accumE is not a primitive,
because it can be expressed in terms of other combinators.)
This general pattern appears very often in practice:
A Behavior (here b) controls what value is put into an Event (here e2),
but at the same time, the Event contributes to changes in this Behavior.
Modeling this situation requires recursion.
For another example, consider a vending machine that sells banana juice.
The amount that the customer still has to pay for a juice
is modeled by a Behavior bAmount.
Whenever the customer inserts a coin into the machine,
an Event eCoin occurs, and the amount will be reduced.
Whenver the amount goes below zero, an Event eSold will occur,
indicating the release of a bottle of fresh banana juice,
and the amount to be paid will be reset to the original price.
The model requires recursion, and can be expressed in code as follows:
mdo
let price = 50 :: Int
bAmount <- accumB price $ unions
[ subtract 10 <$ eCoin
, const price <$ eSold ]
let eSold = whenE ((<= 0) <$> bAmount) eCoinOn one hand, the Behavior bAmount controls whether the Event eSold
occcurs at all; the bottle of banana juice is unavailable to penniless customers.
But at the same time, the Event eSold will cause a reset
of the Behavior bAmount, so both depend on each other.
Recursive code like this examples works thanks to the semantics of stepper.
In general, mutual recursion between several Events and Behaviors
is always well-defined,
as long as an Event depends on itself only via a Behavior,
and vice versa.
Higher-order
valueB :: MonadMoment m => Behavior a -> m a Source #
Obtain the value of the Behavior at a given moment in time.
Semantically, it corresponds to
valueB b = \time -> b time
Note: The value is immediately available for pattern matching.
Unfortunately, this means that valueB is unsuitable for use
with value recursion in the Moment monad.
If you need recursion, please use valueBLater instead.
valueBLater :: MonadMoment m => Behavior a -> m a Source #
Obtain the value of the Behavior at a given moment in time.
Semantically, it corresponds to
valueBLater b = \time -> b time
Note: To allow for more recursion, the value is returned lazily
and not available for pattern matching immediately.
It can be used safely with most combinators like stepper.
If that doesn't work for you, please use valueB instead.
observeE :: Event (Moment a) -> Event a Source #
Observe a value at those moments in time where event occurrences happen. Semantically,
observeE e = [(time, m time) | (time, m) <- e]
switchE :: MonadMoment m => Event a -> Event (Event a) -> m (Event a) Source #
Dynamically switch between Event.
Semantically,
switchE e0 ee0 time0 =
concat [ trim t1 t2 e | (t1,t2,e) <- intervals ee ]
where
laterThan e time0 = [(timex,x) | (timex,x) <- e, time0 < timex ]
ee = [(time0, e0)] ++ (ee0 `laterThan` time0)
intervals ee = [(time1, time2, e) | ((time1,e),(time2,_)) <- zip ee (tail ee)]
trim time1 time2 e = [x | (timex,x) <- e, time1 < timex, timex <= time2]switchB :: MonadMoment m => Behavior a -> Event (Behavior a) -> m (Behavior a) Source #
Dynamically switch between Behavior.
Semantically,
switchB b0 eb = \time0 -> \time1 ->
last (b0 : [b | (timeb,b) <- eb, time0 <= timeb, timeb < time1]) time1Derived Combinators
Infix operators
(<@) :: Behavior b -> Event a -> Event b infixl 4 Source #
Tag all event occurrences with a time-varying value. Similar to <*.
infixl 4 <@
Filtering
filterJust :: Event (Maybe a) -> Event a Source #
Allow all event occurrences that are Just values, discard the rest.
Variant of filterE.
filterApply :: Behavior (a -> Bool) -> Event a -> Event a Source #
Allow all events that fulfill the time-varying predicate, discard the rest.
Generalization of filterE.
whenE :: Behavior Bool -> Event a -> Event a Source #
Allow events only when the behavior is True.
Variant of filterApply.
split :: Event (Either a b) -> (Event a, Event b) Source #
Split event occurrences according to a tag.
The Left values go into the left component while the Right values
go into the right component of the result.
once :: MonadMoment m => Event a -> m (Event a) Source #
Keep only the next occurence of an event.
once also aids the garbage collector by indicating that the result event can be discarded after its only occurrence.
once e = \time0 -> take 1 [(t, a) | (t, a) <- e, time0 <= t]
Accumulation
Note: All accumulation functions are strict in the accumulated value!
Note: The order of arguments is acc -> (x,acc)
which is also the convention used by unfoldr and State.
unions :: [Event (a -> a)] -> Event (a -> a) Source #
Merge event streams whose values are functions. In case of simultaneous occurrences, the functions at the beginning of the list are applied after the functions at the end.
unions [] = never unions xs = foldr1 (unionWith (.)) xs
Very useful in conjunction with accumulation functions like accumB
and accumE.
accumB :: MonadMoment m => a -> Event (a -> a) -> m (Behavior a) Source #
The accumB function accumulates event occurrences into a Behavior.
The value is accumulated using accumE and converted
into a time-varying value using stepper.
Example:
accumB "x" [(time1,(++"y")),(time2,(++"z"))] = stepper "x" [(time1,"xy"),(time2,"xyz")]
Note: As with stepper, the value of the behavior changes "slightly after"
the events occur. This allows for recursive definitions.
Merging events
Arguments
| :: (a -> c) | The function called when only the first event emits a value. |
| -> (b -> c) | The function called when only the second event emits a value. |
| -> (a -> b -> c) | The function called when both events emit values simultaneously. |
| -> Event a | |
| -> Event b | |
| -> Event c |
Merge two event streams of any type.
This function generalizes unionWith.