{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
module FRP.Rhine.SN.Combinators where
import FRP.Rhine.ClSF.Core
import FRP.Rhine.Clock
import FRP.Rhine.Clock.Proxy
import FRP.Rhine.ResamplingBuffer.Util
import FRP.Rhine.SN
import FRP.Rhine.Schedule
(>>>^)
:: Monad m
=> SN m cl a b
-> (b -> c)
-> SN m cl a c
Synchronous ClSF m cl a b
clsf >>>^ :: forall (m :: Type -> Type) cl a b c.
Monad m =>
SN m cl a b -> (b -> c) -> SN m cl a c
>>>^ b -> c
f = forall cl (m :: Type -> Type) a b.
(cl ~ In cl, cl ~ Out cl) =>
ClSF m cl a b -> SN m cl a b
Synchronous forall a b. (a -> b) -> a -> b
$ ClSF m cl a b
clsf forall (a :: Type -> Type -> Type) b c d.
Arrow a =>
a b c -> (c -> d) -> a b d
>>^ b -> c
f
Sequential SN m clab a b
sn1 ResamplingBuffer m (Out clab) (In clcd) b c
rb SN m clcd c b
sn2 >>>^ b -> c
f = forall (m :: Type -> Type) a b a c d d.
(Clock m a, Clock m b, Clock m (Out a), Clock m (Out b),
Clock m (In a), Clock m (In b), GetClockProxy a, GetClockProxy b,
Time a ~ Time b, Time a ~ Time (Out a), Time b ~ Time (In b)) =>
SN m a a c
-> ResamplingBuffer m (Out a) (In b) c d
-> SN m b d d
-> SN m (SequentialClock m a b) a d
Sequential SN m clab a b
sn1 ResamplingBuffer m (Out clab) (In clcd) b c
rb forall a b. (a -> b) -> a -> b
$ SN m clcd c b
sn2 forall (m :: Type -> Type) cl a b c.
Monad m =>
SN m cl a b -> (b -> c) -> SN m cl a c
>>>^ b -> c
f
Parallel SN m cl1 a b
sn1 SN m cl2 a b
sn2 >>>^ b -> c
f = forall (m :: Type -> Type) a b a b.
(Clock m a, Clock m b, Clock m (Out a), Clock m (Out b),
GetClockProxy a, GetClockProxy b, Time a ~ Time (Out a),
Time b ~ Time (Out b), Time a ~ Time b, Time a ~ Time (In a),
Time b ~ Time (In b)) =>
SN m a a b -> SN m b a b -> SN m (ParallelClock m a b) a b
Parallel (SN m cl1 a b
sn1 forall (m :: Type -> Type) cl a b c.
Monad m =>
SN m cl a b -> (b -> c) -> SN m cl a c
>>>^ b -> c
f) (SN m cl2 a b
sn2 forall (m :: Type -> Type) cl a b c.
Monad m =>
SN m cl a b -> (b -> c) -> SN m cl a c
>>>^ b -> c
f)
Postcompose SN m cl a b
sn ClSF m (Out cl) b b
clsf >>>^ b -> c
f = forall (m :: Type -> Type) cl a a c.
(Clock m (Out cl), Time cl ~ Time (Out cl)) =>
SN m cl a a -> ClSF m (Out cl) a c -> SN m cl a c
Postcompose SN m cl a b
sn forall a b. (a -> b) -> a -> b
$ ClSF m (Out cl) b b
clsf forall (a :: Type -> Type -> Type) b c d.
Arrow a =>
a b c -> (c -> d) -> a b d
>>^ b -> c
f
Precompose ClSF m (In cl) a b
clsf SN m cl b b
sn >>>^ b -> c
f = forall (m :: Type -> Type) cl a a c.
(Clock m (In cl), Time cl ~ Time (In cl)) =>
ClSF m (In cl) a a -> SN m cl a c -> SN m cl a c
Precompose ClSF m (In cl) a b
clsf forall a b. (a -> b) -> a -> b
$ SN m cl b b
sn forall (m :: Type -> Type) cl a b c.
Monad m =>
SN m cl a b -> (b -> c) -> SN m cl a c
>>>^ b -> c
f
Feedback ResBuf m (Out cl) (In cl) d c
buf SN m cl (a, c) (b, d)
sn >>>^ b -> c
f = forall (m :: Type -> Type) cl a b a b.
(Clock m (In cl), Clock m (Out cl), Time (In cl) ~ Time cl,
Time (Out cl) ~ Time cl) =>
ResBuf m (Out cl) (In cl) a b
-> SN m cl (a, b) (b, a) -> SN m cl a b
Feedback ResBuf m (Out cl) (In cl) d c
buf forall a b. (a -> b) -> a -> b
$ SN m cl (a, c) (b, d)
sn forall (m :: Type -> Type) cl a b c.
Monad m =>
SN m cl a b -> (b -> c) -> SN m cl a c
>>>^ forall (a :: Type -> Type -> Type) b c d.
Arrow a =>
a b c -> a (b, d) (c, d)
first b -> c
f
firstResampling :: SN m cl a b
firstResampling@(FirstResampling SN m cl a b
_ ResamplingBuffer m (In cl) (Out cl) c d
_) >>>^ b -> c
f = forall (m :: Type -> Type) cl a a c.
(Clock m (Out cl), Time cl ~ Time (Out cl)) =>
SN m cl a a -> ClSF m (Out cl) a c -> SN m cl a c
Postcompose SN m cl a b
firstResampling forall a b. (a -> b) -> a -> b
$ forall (a :: Type -> Type -> Type) b c.
Arrow a =>
(b -> c) -> a b c
arr b -> c
f
(^>>>)
:: Monad m
=> (a -> b)
-> SN m cl b c
-> SN m cl a c
a -> b
f ^>>> :: forall (m :: Type -> Type) a b cl c.
Monad m =>
(a -> b) -> SN m cl b c -> SN m cl a c
^>>> Synchronous ClSF m cl b c
clsf = forall cl (m :: Type -> Type) a b.
(cl ~ In cl, cl ~ Out cl) =>
ClSF m cl a b -> SN m cl a b
Synchronous forall a b. (a -> b) -> a -> b
$ a -> b
f forall (a :: Type -> Type -> Type) b c d.
Arrow a =>
(b -> c) -> a c d -> a b d
^>> ClSF m cl b c
clsf
a -> b
f ^>>> Sequential SN m clab b b
sn1 ResamplingBuffer m (Out clab) (In clcd) b c
rb SN m clcd c c
sn2 = forall (m :: Type -> Type) a b a c d d.
(Clock m a, Clock m b, Clock m (Out a), Clock m (Out b),
Clock m (In a), Clock m (In b), GetClockProxy a, GetClockProxy b,
Time a ~ Time b, Time a ~ Time (Out a), Time b ~ Time (In b)) =>
SN m a a c
-> ResamplingBuffer m (Out a) (In b) c d
-> SN m b d d
-> SN m (SequentialClock m a b) a d
Sequential (a -> b
f forall (m :: Type -> Type) a b cl c.
Monad m =>
(a -> b) -> SN m cl b c -> SN m cl a c
^>>> SN m clab b b
sn1) ResamplingBuffer m (Out clab) (In clcd) b c
rb SN m clcd c c
sn2
a -> b
f ^>>> Parallel SN m cl1 b c
sn1 SN m cl2 b c
sn2 = forall (m :: Type -> Type) a b a b.
(Clock m a, Clock m b, Clock m (Out a), Clock m (Out b),
GetClockProxy a, GetClockProxy b, Time a ~ Time (Out a),
Time b ~ Time (Out b), Time a ~ Time b, Time a ~ Time (In a),
Time b ~ Time (In b)) =>
SN m a a b -> SN m b a b -> SN m (ParallelClock m a b) a b
Parallel (a -> b
f forall (m :: Type -> Type) a b cl c.
Monad m =>
(a -> b) -> SN m cl b c -> SN m cl a c
^>>> SN m cl1 b c
sn1) (a -> b
f forall (m :: Type -> Type) a b cl c.
Monad m =>
(a -> b) -> SN m cl b c -> SN m cl a c
^>>> SN m cl2 b c
sn2)
a -> b
f ^>>> Postcompose SN m cl b b
sn ClSF m (Out cl) b c
clsf = forall (m :: Type -> Type) cl a a c.
(Clock m (Out cl), Time cl ~ Time (Out cl)) =>
SN m cl a a -> ClSF m (Out cl) a c -> SN m cl a c
Postcompose (a -> b
f forall (m :: Type -> Type) a b cl c.
Monad m =>
(a -> b) -> SN m cl b c -> SN m cl a c
^>>> SN m cl b b
sn) ClSF m (Out cl) b c
clsf
a -> b
f ^>>> Precompose ClSF m (In cl) b b
clsf SN m cl b c
sn = forall (m :: Type -> Type) cl a a c.
(Clock m (In cl), Time cl ~ Time (In cl)) =>
ClSF m (In cl) a a -> SN m cl a c -> SN m cl a c
Precompose (a -> b
f forall (a :: Type -> Type -> Type) b c d.
Arrow a =>
(b -> c) -> a c d -> a b d
^>> ClSF m (In cl) b b
clsf) SN m cl b c
sn
a -> b
f ^>>> Feedback ResBuf m (Out cl) (In cl) d c
buf SN m cl (b, c) (c, d)
sn = forall (m :: Type -> Type) cl a b a b.
(Clock m (In cl), Clock m (Out cl), Time (In cl) ~ Time cl,
Time (Out cl) ~ Time cl) =>
ResBuf m (Out cl) (In cl) a b
-> SN m cl (a, b) (b, a) -> SN m cl a b
Feedback ResBuf m (Out cl) (In cl) d c
buf forall a b. (a -> b) -> a -> b
$ forall (a :: Type -> Type -> Type) b c d.
Arrow a =>
a b c -> a (b, d) (c, d)
first a -> b
f forall (m :: Type -> Type) a b cl c.
Monad m =>
(a -> b) -> SN m cl b c -> SN m cl a c
^>>> SN m cl (b, c) (c, d)
sn
a -> b
f ^>>> firstResampling :: SN m cl b c
firstResampling@(FirstResampling SN m cl a b
_ ResamplingBuffer m (In cl) (Out cl) c d
_) = forall (m :: Type -> Type) cl a a c.
(Clock m (In cl), Time cl ~ Time (In cl)) =>
ClSF m (In cl) a a -> SN m cl a c -> SN m cl a c
Precompose (forall (a :: Type -> Type -> Type) b c.
Arrow a =>
(b -> c) -> a b c
arr a -> b
f) SN m cl b c
firstResampling
(>--^)
:: ( Clock m (Out cl)
, Time cl ~ Time (Out cl)
)
=> SN m cl a b
-> ClSF m (Out cl) b c
-> SN m cl a c
>--^ :: forall (m :: Type -> Type) cl a a c.
(Clock m (Out cl), Time cl ~ Time (Out cl)) =>
SN m cl a a -> ClSF m (Out cl) a c -> SN m cl a c
(>--^) = forall (m :: Type -> Type) cl a a c.
(Clock m (Out cl), Time cl ~ Time (Out cl)) =>
SN m cl a a -> ClSF m (Out cl) a c -> SN m cl a c
Postcompose
(^-->)
:: ( Clock m (In cl)
, Time cl ~ Time (In cl)
)
=> ClSF m (In cl) a b
-> SN m cl b c
-> SN m cl a c
^--> :: forall (m :: Type -> Type) cl a a c.
(Clock m (In cl), Time cl ~ Time (In cl)) =>
ClSF m (In cl) a a -> SN m cl a c -> SN m cl a c
(^-->) = forall (m :: Type -> Type) cl a a c.
(Clock m (In cl), Time cl ~ Time (In cl)) =>
ClSF m (In cl) a a -> SN m cl a c -> SN m cl a c
Precompose
(****)
:: Monad m
=> SN m cl a b
-> SN m cl c d
-> SN m cl (a, c) (b, d)
Synchronous ClSF m cl a b
clsf1 **** :: forall (m :: Type -> Type) cl a b c d.
Monad m =>
SN m cl a b -> SN m cl c d -> SN m cl (a, c) (b, d)
**** Synchronous ClSF m cl c d
clsf2 = forall cl (m :: Type -> Type) a b.
(cl ~ In cl, cl ~ Out cl) =>
ClSF m cl a b -> SN m cl a b
Synchronous forall a b. (a -> b) -> a -> b
$ ClSF m cl a b
clsf1 forall (a :: Type -> Type -> Type) b c b' c'.
Arrow a =>
a b c -> a b' c' -> a (b, b') (c, c')
*** ClSF m cl c d
clsf2
Sequential SN m clab a b
sn11 ResamplingBuffer m (Out clab) (In clcd) b c
rb1 SN m clcd c b
sn12 **** Sequential SN m clab c b
sn21 ResamplingBuffer m (Out clab) (In clcd) b c
rb2 SN m clcd c d
sn22 = forall (m :: Type -> Type) a b a c d d.
(Clock m a, Clock m b, Clock m (Out a), Clock m (Out b),
Clock m (In a), Clock m (In b), GetClockProxy a, GetClockProxy b,
Time a ~ Time b, Time a ~ Time (Out a), Time b ~ Time (In b)) =>
SN m a a c
-> ResamplingBuffer m (Out a) (In b) c d
-> SN m b d d
-> SN m (SequentialClock m a b) a d
Sequential SN m clab (a, c) (b, b)
sn1 ResamplingBuffer m (Out clab) (In clcd) (b, b) (c, c)
rb SN m clcd (c, c) (b, d)
sn2
where
sn1 :: SN m clab (a, c) (b, b)
sn1 = SN m clab a b
sn11 forall (m :: Type -> Type) cl a b c d.
Monad m =>
SN m cl a b -> SN m cl c d -> SN m cl (a, c) (b, d)
**** SN m clab c b
sn21
sn2 :: SN m clcd (c, c) (b, d)
sn2 = SN m clcd c b
sn12 forall (m :: Type -> Type) cl a b c d.
Monad m =>
SN m cl a b -> SN m cl c d -> SN m cl (a, c) (b, d)
**** SN m clcd c d
sn22
rb :: ResamplingBuffer m (Out clab) (In clcd) (b, b) (c, c)
rb = ResamplingBuffer m (Out clab) (In clcd) b c
rb1 forall (m :: Type -> Type) cl1 cl2 a b c d.
Monad m =>
ResamplingBuffer m cl1 cl2 a b
-> ResamplingBuffer m cl1 cl2 c d
-> ResamplingBuffer m cl1 cl2 (a, c) (b, d)
*-* ResamplingBuffer m (Out clab) (In clcd) b c
rb2
Parallel SN m cl1 a b
sn11 SN m cl2 a b
sn12 **** Parallel SN m cl1 c d
sn21 SN m cl2 c d
sn22 =
forall (m :: Type -> Type) a b a b.
(Clock m a, Clock m b, Clock m (Out a), Clock m (Out b),
GetClockProxy a, GetClockProxy b, Time a ~ Time (Out a),
Time b ~ Time (Out b), Time a ~ Time b, Time a ~ Time (In a),
Time b ~ Time (In b)) =>
SN m a a b -> SN m b a b -> SN m (ParallelClock m a b) a b
Parallel (SN m cl1 a b
sn11 forall (m :: Type -> Type) cl a b c d.
Monad m =>
SN m cl a b -> SN m cl c d -> SN m cl (a, c) (b, d)
**** SN m cl1 c d
sn21) (SN m cl2 a b
sn12 forall (m :: Type -> Type) cl a b c d.
Monad m =>
SN m cl a b -> SN m cl c d -> SN m cl (a, c) (b, d)
**** SN m cl2 c d
sn22)
Precompose ClSF m (In cl) a b
clsf SN m cl b b
sn1 **** SN m cl c d
sn2 = forall (m :: Type -> Type) cl a a c.
(Clock m (In cl), Time cl ~ Time (In cl)) =>
ClSF m (In cl) a a -> SN m cl a c -> SN m cl a c
Precompose (forall (a :: Type -> Type -> Type) b c d.
Arrow a =>
a b c -> a (b, d) (c, d)
first ClSF m (In cl) a b
clsf) forall a b. (a -> b) -> a -> b
$ SN m cl b b
sn1 forall (m :: Type -> Type) cl a b c d.
Monad m =>
SN m cl a b -> SN m cl c d -> SN m cl (a, c) (b, d)
**** SN m cl c d
sn2
SN m cl a b
sn1 **** Precompose ClSF m (In cl) c b
clsf SN m cl b d
sn2 = forall (m :: Type -> Type) cl a a c.
(Clock m (In cl), Time cl ~ Time (In cl)) =>
ClSF m (In cl) a a -> SN m cl a c -> SN m cl a c
Precompose (forall (a :: Type -> Type -> Type) b c d.
Arrow a =>
a b c -> a (d, b) (d, c)
second ClSF m (In cl) c b
clsf) forall a b. (a -> b) -> a -> b
$ SN m cl a b
sn1 forall (m :: Type -> Type) cl a b c d.
Monad m =>
SN m cl a b -> SN m cl c d -> SN m cl (a, c) (b, d)
**** SN m cl b d
sn2
Postcompose SN m cl a b
sn1 ClSF m (Out cl) b b
clsf **** SN m cl c d
sn2 = forall (m :: Type -> Type) cl a a c.
(Clock m (Out cl), Time cl ~ Time (Out cl)) =>
SN m cl a a -> ClSF m (Out cl) a c -> SN m cl a c
Postcompose (SN m cl a b
sn1 forall (m :: Type -> Type) cl a b c d.
Monad m =>
SN m cl a b -> SN m cl c d -> SN m cl (a, c) (b, d)
**** SN m cl c d
sn2) (forall (a :: Type -> Type -> Type) b c d.
Arrow a =>
a b c -> a (b, d) (c, d)
first ClSF m (Out cl) b b
clsf)
SN m cl a b
sn1 **** Postcompose SN m cl c b
sn2 ClSF m (Out cl) b d
clsf = forall (m :: Type -> Type) cl a a c.
(Clock m (Out cl), Time cl ~ Time (Out cl)) =>
SN m cl a a -> ClSF m (Out cl) a c -> SN m cl a c
Postcompose (SN m cl a b
sn1 forall (m :: Type -> Type) cl a b c d.
Monad m =>
SN m cl a b -> SN m cl c d -> SN m cl (a, c) (b, d)
**** SN m cl c b
sn2) (forall (a :: Type -> Type -> Type) b c d.
Arrow a =>
a b c -> a (d, b) (d, c)
second ClSF m (Out cl) b d
clsf)
Feedback ResBuf m (Out cl) (In cl) d c
buf SN m cl (a, c) (b, d)
sn1 **** SN m cl c d
sn2 = forall (m :: Type -> Type) cl a b a b.
(Clock m (In cl), Clock m (Out cl), Time (In cl) ~ Time cl,
Time (Out cl) ~ Time cl) =>
ResBuf m (Out cl) (In cl) a b
-> SN m cl (a, b) (b, a) -> SN m cl a b
Feedback ResBuf m (Out cl) (In cl) d c
buf forall a b. (a -> b) -> a -> b
$ (\((a
a, c
c), c
c1) -> ((a
a, c
c1), c
c)) forall (m :: Type -> Type) a b cl c.
Monad m =>
(a -> b) -> SN m cl b c -> SN m cl a c
^>>> (SN m cl (a, c) (b, d)
sn1 forall (m :: Type -> Type) cl a b c d.
Monad m =>
SN m cl a b -> SN m cl c d -> SN m cl (a, c) (b, d)
**** SN m cl c d
sn2) forall (m :: Type -> Type) cl a b c.
Monad m =>
SN m cl a b -> (b -> c) -> SN m cl a c
>>>^ (\((b
b, d
d1), d
d) -> ((b
b, d
d), d
d1))
SN m cl a b
sn1 **** Feedback ResBuf m (Out cl) (In cl) d c
buf SN m cl (c, c) (d, d)
sn2 = forall (m :: Type -> Type) cl a b a b.
(Clock m (In cl), Clock m (Out cl), Time (In cl) ~ Time cl,
Time (Out cl) ~ Time cl) =>
ResBuf m (Out cl) (In cl) a b
-> SN m cl (a, b) (b, a) -> SN m cl a b
Feedback ResBuf m (Out cl) (In cl) d c
buf forall a b. (a -> b) -> a -> b
$ (\((a
a, c
c), c
c1) -> (a
a, (c
c, c
c1))) forall (m :: Type -> Type) a b cl c.
Monad m =>
(a -> b) -> SN m cl b c -> SN m cl a c
^>>> (SN m cl a b
sn1 forall (m :: Type -> Type) cl a b c d.
Monad m =>
SN m cl a b -> SN m cl c d -> SN m cl (a, c) (b, d)
**** SN m cl (c, c) (d, d)
sn2) forall (m :: Type -> Type) cl a b c.
Monad m =>
SN m cl a b -> (b -> c) -> SN m cl a c
>>>^ (\(b
b, (d
d, d
d1)) -> ((b
b, d
d), d
d1))
FirstResampling SN m cl a b
sn1 ResamplingBuffer m (In cl) (Out cl) c d
buf **** SN m cl c d
sn2 = (\((a
a1, c
c1), c
c) -> ((a
a1, c
c), c
c1)) forall (m :: Type -> Type) a b cl c.
Monad m =>
(a -> b) -> SN m cl b c -> SN m cl a c
^>>> forall (m :: Type -> Type) cl a b c d.
(Clock m (In cl), Clock m (Out cl), Time cl ~ Time (Out cl),
Time cl ~ Time (In cl)) =>
SN m cl a b
-> ResamplingBuffer m (In cl) (Out cl) c d -> SN m cl (a, c) (b, d)
FirstResampling (SN m cl a b
sn1 forall (m :: Type -> Type) cl a b c d.
Monad m =>
SN m cl a b -> SN m cl c d -> SN m cl (a, c) (b, d)
**** SN m cl c d
sn2) ResamplingBuffer m (In cl) (Out cl) c d
buf forall (m :: Type -> Type) cl a b c.
Monad m =>
SN m cl a b -> (b -> c) -> SN m cl a c
>>>^ (\((b
b1, d
d), d
d1) -> ((b
b1, d
d1), d
d))
SN m cl a b
sn1 **** FirstResampling SN m cl a b
sn2 ResamplingBuffer m (In cl) (Out cl) c d
buf = (\(a
a, (a
a1, c
c1)) -> ((a
a, a
a1), c
c1)) forall (m :: Type -> Type) a b cl c.
Monad m =>
(a -> b) -> SN m cl b c -> SN m cl a c
^>>> forall (m :: Type -> Type) cl a b c d.
(Clock m (In cl), Clock m (Out cl), Time cl ~ Time (Out cl),
Time cl ~ Time (In cl)) =>
SN m cl a b
-> ResamplingBuffer m (In cl) (Out cl) c d -> SN m cl (a, c) (b, d)
FirstResampling (SN m cl a b
sn1 forall (m :: Type -> Type) cl a b c d.
Monad m =>
SN m cl a b -> SN m cl c d -> SN m cl (a, c) (b, d)
**** SN m cl a b
sn2) ResamplingBuffer m (In cl) (Out cl) c d
buf forall (m :: Type -> Type) cl a b c.
Monad m =>
SN m cl a b -> (b -> c) -> SN m cl a c
>>>^ (\((b
b, b
b1), d
d1) -> (b
b, (b
b1, d
d1)))
Synchronous ClSF m cl a b
_ **** Parallel SN m cl1 c d
_ SN m cl2 c d
_ = forall a. HasCallStack => [Char] -> a
error [Char]
"Impossible pattern: Synchronous _ **** Parallel _ _"
Parallel SN m cl1 a b
_ SN m cl2 a b
_ **** Synchronous ClSF m cl c d
_ = forall a. HasCallStack => [Char] -> a
error [Char]
"Impossible pattern: Parallel _ _ **** Synchronous _"
Synchronous ClSF m cl a b
_ **** Sequential {} = forall a. HasCallStack => [Char] -> a
error [Char]
"Impossible pattern: Synchronous _ **** Sequential {}"
Sequential {} **** Synchronous ClSF m cl c d
_ = forall a. HasCallStack => [Char] -> a
error [Char]
"Impossible pattern: Sequential {} **** Synchronous _"
(||||)
:: ( Monad m, Clock m clL, Clock m clR
, Clock m (Out clL), Clock m (Out clR)
, GetClockProxy clL, GetClockProxy clR
, Time clL ~ Time clR
, Time clL ~ Time (Out clL), Time clL ~ Time (In clL)
, Time clR ~ Time (Out clR), Time clR ~ Time (In clR)
)
=> SN m clL a b
-> SN m clR a b
-> SN m (ParClock m clL clR) a b
|||| :: forall (m :: Type -> Type) clL clR a b.
(Monad m, Clock m clL, Clock m clR, Clock m (Out clL),
Clock m (Out clR), GetClockProxy clL, GetClockProxy clR,
Time clL ~ Time clR, Time clL ~ Time (Out clL),
Time clL ~ Time (In clL), Time clR ~ Time (Out clR),
Time clR ~ Time (In clR)) =>
SN m clL a b -> SN m clR a b -> SN m (ParClock m clL clR) a b
(||||) = forall (m :: Type -> Type) a b a b.
(Clock m a, Clock m b, Clock m (Out a), Clock m (Out b),
GetClockProxy a, GetClockProxy b, Time a ~ Time (Out a),
Time b ~ Time (Out b), Time a ~ Time b, Time a ~ Time (In a),
Time b ~ Time (In b)) =>
SN m a a b -> SN m b a b -> SN m (ParallelClock m a b) a b
Parallel
(++++)
:: ( Monad m, Clock m clL, Clock m clR
, Clock m (Out clL), Clock m (Out clR)
, GetClockProxy clL, GetClockProxy clR
, Time clL ~ Time clR
, Time clL ~ Time (Out clL), Time clL ~ Time (In clL)
, Time clR ~ Time (Out clR), Time clR ~ Time (In clR)
)
=> SN m clL a b
-> SN m clR a c
-> SN m (ParClock m clL clR) a (Either b c)
SN m clL a b
snL ++++ :: forall (m :: Type -> Type) clL clR a b c.
(Monad m, Clock m clL, Clock m clR, Clock m (Out clL),
Clock m (Out clR), GetClockProxy clL, GetClockProxy clR,
Time clL ~ Time clR, Time clL ~ Time (Out clL),
Time clL ~ Time (In clL), Time clR ~ Time (Out clR),
Time clR ~ Time (In clR)) =>
SN m clL a b
-> SN m clR a c -> SN m (ParClock m clL clR) a (Either b c)
++++ SN m clR a c
snR = (SN m clL a b
snL forall (m :: Type -> Type) cl a b c.
Monad m =>
SN m cl a b -> (b -> c) -> SN m cl a c
>>>^ forall a b. a -> Either a b
Left) forall (m :: Type -> Type) clL clR a b.
(Monad m, Clock m clL, Clock m clR, Clock m (Out clL),
Clock m (Out clR), GetClockProxy clL, GetClockProxy clR,
Time clL ~ Time clR, Time clL ~ Time (Out clL),
Time clL ~ Time (In clL), Time clR ~ Time (Out clR),
Time clR ~ Time (In clR)) =>
SN m clL a b -> SN m clR a b -> SN m (ParClock m clL clR) a b
|||| (SN m clR a c
snR forall (m :: Type -> Type) cl a b c.
Monad m =>
SN m cl a b -> (b -> c) -> SN m cl a c
>>>^ forall a b. b -> Either a b
Right)