{- |
Copyright   :  (c) Henning Thielemann 2007-2010

Maintainer  :  haskell@henning-thielemann.de
Stability   :  stable
Portability :  Haskell 98


Event lists starting with a body and ending with a body.

-}
module Data.EventList.Relative.BodyBody
   (T,
    concatMapMonoid, traverse, mapM,
   ) where

import Data.EventList.Relative.BodyBodyPrivate

-- import qualified Data.AlternatingList.List.Disparate as Disp
import qualified Data.AlternatingList.List.Uniform as Uniform

import Control.Monad (Monad, )
import Control.Applicative (Applicative, WrappedMonad(WrapMonad, unwrapMonad), liftA, )
import Data.Monoid (Monoid, )

import Data.Function ((.), )
import Prelude ()


concatMapMonoid :: Monoid m =>
   (time -> m) -> (body -> m) ->
   T time body -> m
concatMapMonoid :: forall m time body.
Monoid m =>
(time -> m) -> (body -> m) -> T time body -> m
concatMapMonoid time -> m
f body -> m
g = forall m time body.
Monoid m =>
(time -> m) -> (body -> m) -> T time body -> m
Uniform.concatMapMonoid time -> m
f body -> m
g forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall time body. T time body -> T time body
decons

traverse :: Applicative m =>
   (time0 -> m time1) -> (body0 -> m body1) ->
   T time0 body0 -> m (T time1 body1)
traverse :: forall (m :: * -> *) time0 time1 body0 body1.
Applicative m =>
(time0 -> m time1)
-> (body0 -> m body1) -> T time0 body0 -> m (T time1 body1)
traverse time0 -> m time1
f body0 -> m body1
g =
   forall (f :: * -> *) a b. Applicative f => (a -> b) -> f a -> f b
liftA forall time body. T time body -> T time body
Cons forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a0 a1 b0 b1.
Applicative m =>
(a0 -> m a1) -> (b0 -> m b1) -> T a0 b0 -> m (T a1 b1)
Uniform.traverse time0 -> m time1
f body0 -> m body1
g forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall time body. T time body -> T time body
decons

mapM :: Monad m =>
   (time0 -> m time1) -> (body0 -> m body1) ->
   T time0 body0 -> m (T time1 body1)
mapM :: forall (m :: * -> *) time0 time1 body0 body1.
Monad m =>
(time0 -> m time1)
-> (body0 -> m body1) -> T time0 body0 -> m (T time1 body1)
mapM time0 -> m time1
f body0 -> m body1
g =
   forall (m :: * -> *) a. WrappedMonad m a -> m a
unwrapMonad forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) time0 time1 body0 body1.
Applicative m =>
(time0 -> m time1)
-> (body0 -> m body1) -> T time0 body0 -> m (T time1 body1)
traverse (forall (m :: * -> *) a. m a -> WrappedMonad m a
WrapMonad forall b c a. (b -> c) -> (a -> b) -> a -> c
. time0 -> m time1
f) (forall (m :: * -> *) a. m a -> WrappedMonad m a
WrapMonad forall b c a. (b -> c) -> (a -> b) -> a -> c
. body0 -> m body1
g)