{-# OPTIONS_GHC -fno-warn-orphans #-}
{-# Language
        TypeFamilies,
        MultiParamTypeClasses,
        FlexibleInstances,
        FlexibleContexts,
        CPP #-}
module Csound.Typed.Types.SigSpace(
    SigSpace(..), BindSig(..), mul, mul', on, uon, At(..), MixAt(..),
    cfd, genCfds, cfd4, cfds,

    -- * Stereo sig-space
    SigSpace2(..), BindSig2(..), mul2, mul2',
) where

import Control.Monad
import Control.Applicative
import Csound.Typed.Types.Prim
import Csound.Typed.GlobalState.SE
import Data.Kind (Type)
import Data.NumInstances.Tuple()

-- | A class for easy way to process the outputs of the instruments.
class SigSpace a where
    mapSig  :: (Sig -> Sig)    -> a -> a

-- | A class for easy way to process the outputs of the instruments.
class SigSpace a => BindSig a where
    bindSig :: (Sig -> SE Sig) -> a -> SE a

-- | A class for easy way to process the outputs of the instruments.
class SigSpace2 a where
    mapSig2  :: (Sig2 -> Sig2)    -> a -> a

-- | A class for easy way to process the outputs of the instruments.
class SigSpace2 a => BindSig2 a where
    bindSig2 :: (Sig2 -> SE Sig2) -> a -> SE a


-- | Scaling the sound.
mul :: SigSpace a => Sig -> a -> a
mul :: forall a. SigSpace a => Sig -> a -> a
mul Sig
k = (Sig -> Sig) -> a -> a
forall a. SigSpace a => (Sig -> Sig) -> a -> a
mapSig (Sig
k Sig -> Sig -> Sig
forall a. Num a => a -> a -> a
* )

-- | Scaling the sound with effectful signal.
mul' :: BindSig a => SE Sig -> a -> SE a
mul' :: forall a. BindSig a => SE Sig -> a -> SE a
mul' SE Sig
k = (Sig -> SE Sig) -> a -> SE a
forall a. BindSig a => (Sig -> SE Sig) -> a -> SE a
bindSig (\Sig
x -> (Sig -> Sig) -> SE Sig -> SE Sig
forall a b. (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Sig -> Sig -> Sig
forall a. Num a => a -> a -> a
* Sig
x) SE Sig
k)

-- | Scaling the sound with a pair.
mul2 :: SigSpace2 a => Sig2 -> a -> a
mul2 :: forall a. SigSpace2 a => Sig2 -> a -> a
mul2 (Sig
ka, Sig
kb) = (Sig2 -> Sig2) -> a -> a
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 (\(Sig
a, Sig
b) -> (Sig
ka Sig -> Sig -> Sig
forall a. Num a => a -> a -> a
* Sig
a, Sig
kb Sig -> Sig -> Sig
forall a. Num a => a -> a -> a
* Sig
b))

-- | Scaling the sound with effectful pair of signals.
mul2' :: BindSig2 a => SE Sig2 -> a -> SE a
mul2' :: forall a. BindSig2 a => SE Sig2 -> a -> SE a
mul2' SE Sig2
k = (Sig2 -> SE Sig2) -> a -> SE a
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 (\(Sig
xa, Sig
xb) -> (Sig2 -> Sig2) -> SE Sig2 -> SE Sig2
forall a b. (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\(Sig
ka, Sig
kb) -> (Sig
ka Sig -> Sig -> Sig
forall a. Num a => a -> a -> a
* Sig
xa, Sig
kb Sig -> Sig -> Sig
forall a. Num a => a -> a -> a
* Sig
xb)) SE Sig2
k)

-- rescaling

-- | Rescaling of the bipolar signal (-1, 1) -> (a, b)
--
-- > on a b biSig
on :: SigSpace a => Sig -> Sig -> a -> a
on :: forall a. SigSpace a => Sig -> Sig -> a -> a
on Sig
a Sig
b a
x = Sig -> Sig -> a -> a
forall a. SigSpace a => Sig -> Sig -> a -> a
uon Sig
a Sig
b (a -> a) -> a -> a
forall a b. (a -> b) -> a -> b
$ (Sig -> Sig) -> a -> a
forall a. SigSpace a => (Sig -> Sig) -> a -> a
mapSig Sig -> Sig
forall {a}. Fractional a => a -> a
unipolar a
x
    where unipolar :: a -> a
unipolar a
v = a
0.5 a -> a -> a
forall a. Num a => a -> a -> a
+ a
0.5 a -> a -> a
forall a. Num a => a -> a -> a
* a
v

-- | Rescaling of the unipolar signal (0, 1) -> (a, b)
--
-- > on a b uniSig
uon :: SigSpace a => Sig -> Sig -> a -> a
uon :: forall a. SigSpace a => Sig -> Sig -> a -> a
uon Sig
a Sig
b = (Sig -> Sig) -> a -> a
forall a. SigSpace a => (Sig -> Sig) -> a -> a
mapSig (\Sig
x -> Sig
a Sig -> Sig -> Sig
forall a. Num a => a -> a -> a
+ (Sig
b Sig -> Sig -> Sig
forall a. Num a => a -> a -> a
- Sig
a) Sig -> Sig -> Sig
forall a. Num a => a -> a -> a
* Sig
x)

-- | Crossfade.
--
-- > cfd coeff sig1 sig2
--
-- If coeff equals 0 then we get the first signal and if it equals 1 we get the second signal.
cfd :: (Num a, SigSpace a) => Sig -> a -> a -> a
cfd :: forall a. (Num a, SigSpace a) => Sig -> a -> a -> a
cfd Sig
coeff a
a a
b = (Sig
1 Sig -> Sig -> Sig
forall a. Num a => a -> a -> a
- Sig
coeff) Sig -> a -> a
forall a. SigSpace a => Sig -> a -> a
`mul` a
a a -> a -> a
forall a. Num a => a -> a -> a
+ Sig
coeff Sig -> a -> a
forall a. SigSpace a => Sig -> a -> a
`mul` a
b

genCfds :: a -> (Sig -> a -> a -> a) -> [Sig] -> [a] -> a
genCfds :: forall a. a -> (Sig -> a -> a -> a) -> [Sig] -> [a] -> a
genCfds a
zero Sig -> a -> a -> a
mixFun [Sig]
cs [a]
xs = case [a]
xs of
    []   -> a
zero
    a
a:[a]
as -> (a -> (a -> a) -> a) -> a -> [a -> a] -> a
forall b a. (b -> a -> b) -> b -> [a] -> b
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl (\a
x a -> a
f -> a -> a
f a
x) a
a ([a -> a] -> a) -> [a -> a] -> a
forall a b. (a -> b) -> a -> b
$ (Sig -> a -> a -> a) -> [Sig] -> [a] -> [a -> a]
forall a b c. (a -> b -> c) -> [a] -> [b] -> [c]
zipWith Sig -> a -> a -> a
mix' [Sig]
cs [a]
as
    where mix' :: Sig -> a -> a -> a
mix' Sig
c a
a a
b = Sig -> a -> a -> a
mixFun Sig
c a
b a
a

-- | Bilinear interpolation for four signals.
-- The signals are placed in the corners of the unit square.
-- The first two signals are the xy coordinates in the square.
--
-- > cfd4 x y a b c d
--
-- * (0, 0) is for a
--
-- * (1, 0) is for b
--
-- * (1, 1) is for c
--
-- * (0, 1) is for d
cfd4 :: (Num a, SigSpace a) => Sig -> Sig -> a -> a -> a -> a -> a
cfd4 :: forall a.
(Num a, SigSpace a) =>
Sig -> Sig -> a -> a -> a -> a -> a
cfd4 Sig
x Sig
y a
a a
b a
c a
d = [a] -> a
forall a. Num a => [a] -> a
forall (t :: * -> *) a. (Foldable t, Num a) => t a -> a
sum ([a] -> a) -> [a] -> a
forall a b. (a -> b) -> a -> b
$ (Sig -> a -> a) -> [Sig] -> [a] -> [a]
forall a b c. (a -> b -> c) -> [a] -> [b] -> [c]
zipWith Sig -> a -> a
forall a. SigSpace a => Sig -> a -> a
mul [(Sig
1 Sig -> Sig -> Sig
forall a. Num a => a -> a -> a
- Sig
x) Sig -> Sig -> Sig
forall a. Num a => a -> a -> a
* (Sig
1 Sig -> Sig -> Sig
forall a. Num a => a -> a -> a
- Sig
y), Sig
x Sig -> Sig -> Sig
forall a. Num a => a -> a -> a
* (Sig
1 Sig -> Sig -> Sig
forall a. Num a => a -> a -> a
- Sig
y) , Sig
x Sig -> Sig -> Sig
forall a. Num a => a -> a -> a
* Sig
y, (Sig
1 Sig -> Sig -> Sig
forall a. Num a => a -> a -> a
- Sig
x) Sig -> Sig -> Sig
forall a. Num a => a -> a -> a
* Sig
y] [a
a, a
b, a
c, a
d]

-- | Generic crossfade for n coefficients and n+1 signals.
--
-- > cfds coeffs sigs
cfds :: (Num a, SigSpace a) => [Sig] -> [a] -> a
cfds :: forall a. (Num a, SigSpace a) => [Sig] -> [a] -> a
cfds = a -> (Sig -> a -> a -> a) -> [Sig] -> [a] -> a
forall a. a -> (Sig -> a -> a -> a) -> [Sig] -> [a] -> a
genCfds a
0 Sig -> a -> a -> a
forall a. (Num a, SigSpace a) => Sig -> a -> a -> a
cfd


instance SigSpace Sig   where  mapSig :: (Sig -> Sig) -> Sig -> Sig
mapSig = (Sig -> Sig) -> Sig -> Sig
forall a. a -> a
id
instance BindSig  Sig   where  bindSig :: (Sig -> SE Sig) -> Sig -> SE Sig
bindSig = (Sig -> SE Sig) -> Sig -> SE Sig
forall a. a -> a
id

#if __GLASGOW_HASKELL__ >= 710
instance (SigSpace a1, SigSpace a2) => SigSpace (a1, a2) where  mapSig :: (Sig -> Sig) -> (a1, a2) -> (a1, a2)
mapSig  Sig -> Sig
f (a1
a1, a2
a2) = ((Sig -> Sig) -> a1 -> a1
forall a. SigSpace a => (Sig -> Sig) -> a -> a
mapSig Sig -> Sig
f a1
a1, (Sig -> Sig) -> a2 -> a2
forall a. SigSpace a => (Sig -> Sig) -> a -> a
mapSig Sig -> Sig
f a2
a2)
instance (BindSig a1, BindSig a2) => BindSig  (a1, a2) where  bindSig :: (Sig -> SE Sig) -> (a1, a2) -> SE (a1, a2)
bindSig Sig -> SE Sig
f (a1
a1, a2
a2) = (,) (a1 -> a2 -> (a1, a2)) -> SE a1 -> SE (a2 -> (a1, a2))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Sig -> SE Sig) -> a1 -> SE a1
forall a. BindSig a => (Sig -> SE Sig) -> a -> SE a
bindSig Sig -> SE Sig
f a1
a1 SE (a2 -> (a1, a2)) -> SE a2 -> SE (a1, a2)
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig -> SE Sig) -> a2 -> SE a2
forall a. BindSig a => (Sig -> SE Sig) -> a -> SE a
bindSig Sig -> SE Sig
f a2
a2

instance (SigSpace a1, SigSpace a2, SigSpace a3) => SigSpace (a1, a2, a3) where mapSig :: (Sig -> Sig) -> (a1, a2, a3) -> (a1, a2, a3)
mapSig  Sig -> Sig
f (a1
a1, a2
a2, a3
a3) = ((Sig -> Sig) -> a1 -> a1
forall a. SigSpace a => (Sig -> Sig) -> a -> a
mapSig Sig -> Sig
f a1
a1, (Sig -> Sig) -> a2 -> a2
forall a. SigSpace a => (Sig -> Sig) -> a -> a
mapSig Sig -> Sig
f a2
a2, (Sig -> Sig) -> a3 -> a3
forall a. SigSpace a => (Sig -> Sig) -> a -> a
mapSig Sig -> Sig
f a3
a3)
instance (BindSig a1, BindSig a2, BindSig a3) => BindSig  (a1, a2, a3) where bindSig :: (Sig -> SE Sig) -> (a1, a2, a3) -> SE (a1, a2, a3)
bindSig Sig -> SE Sig
f (a1
a1, a2
a2, a3
a3) = (,,) (a1 -> a2 -> a3 -> (a1, a2, a3))
-> SE a1 -> SE (a2 -> a3 -> (a1, a2, a3))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Sig -> SE Sig) -> a1 -> SE a1
forall a. BindSig a => (Sig -> SE Sig) -> a -> SE a
bindSig Sig -> SE Sig
f a1
a1 SE (a2 -> a3 -> (a1, a2, a3)) -> SE a2 -> SE (a3 -> (a1, a2, a3))
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig -> SE Sig) -> a2 -> SE a2
forall a. BindSig a => (Sig -> SE Sig) -> a -> SE a
bindSig Sig -> SE Sig
f a2
a2 SE (a3 -> (a1, a2, a3)) -> SE a3 -> SE (a1, a2, a3)
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig -> SE Sig) -> a3 -> SE a3
forall a. BindSig a => (Sig -> SE Sig) -> a -> SE a
bindSig Sig -> SE Sig
f a3
a3

instance (SigSpace a1, SigSpace a2, SigSpace a3, SigSpace a4) => SigSpace (a1, a2, a3, a4) where mapSig :: (Sig -> Sig) -> (a1, a2, a3, a4) -> (a1, a2, a3, a4)
mapSig  Sig -> Sig
f (a1
a1, a2
a2, a3
a3, a4
a4) = ((Sig -> Sig) -> a1 -> a1
forall a. SigSpace a => (Sig -> Sig) -> a -> a
mapSig Sig -> Sig
f a1
a1, (Sig -> Sig) -> a2 -> a2
forall a. SigSpace a => (Sig -> Sig) -> a -> a
mapSig Sig -> Sig
f a2
a2, (Sig -> Sig) -> a3 -> a3
forall a. SigSpace a => (Sig -> Sig) -> a -> a
mapSig Sig -> Sig
f a3
a3, (Sig -> Sig) -> a4 -> a4
forall a. SigSpace a => (Sig -> Sig) -> a -> a
mapSig Sig -> Sig
f a4
a4)
instance (BindSig a1, BindSig a2, BindSig a3, BindSig a4) => BindSig  (a1, a2, a3, a4) where bindSig :: (Sig -> SE Sig) -> (a1, a2, a3, a4) -> SE (a1, a2, a3, a4)
bindSig Sig -> SE Sig
f (a1
a1, a2
a2, a3
a3, a4
a4) = (,,,) (a1 -> a2 -> a3 -> a4 -> (a1, a2, a3, a4))
-> SE a1 -> SE (a2 -> a3 -> a4 -> (a1, a2, a3, a4))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Sig -> SE Sig) -> a1 -> SE a1
forall a. BindSig a => (Sig -> SE Sig) -> a -> SE a
bindSig Sig -> SE Sig
f a1
a1 SE (a2 -> a3 -> a4 -> (a1, a2, a3, a4))
-> SE a2 -> SE (a3 -> a4 -> (a1, a2, a3, a4))
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig -> SE Sig) -> a2 -> SE a2
forall a. BindSig a => (Sig -> SE Sig) -> a -> SE a
bindSig Sig -> SE Sig
f a2
a2 SE (a3 -> a4 -> (a1, a2, a3, a4))
-> SE a3 -> SE (a4 -> (a1, a2, a3, a4))
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig -> SE Sig) -> a3 -> SE a3
forall a. BindSig a => (Sig -> SE Sig) -> a -> SE a
bindSig Sig -> SE Sig
f a3
a3 SE (a4 -> (a1, a2, a3, a4)) -> SE a4 -> SE (a1, a2, a3, a4)
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig -> SE Sig) -> a4 -> SE a4
forall a. BindSig a => (Sig -> SE Sig) -> a -> SE a
bindSig Sig -> SE Sig
f a4
a4

instance (SigSpace a1, SigSpace a2, SigSpace a3, SigSpace a4, SigSpace a5) => SigSpace (a1, a2, a3, a4, a5) where mapSig :: (Sig -> Sig) -> (a1, a2, a3, a4, a5) -> (a1, a2, a3, a4, a5)
mapSig  Sig -> Sig
f (a1
a1, a2
a2, a3
a3, a4
a4, a5
a5) = ((Sig -> Sig) -> a1 -> a1
forall a. SigSpace a => (Sig -> Sig) -> a -> a
mapSig Sig -> Sig
f a1
a1, (Sig -> Sig) -> a2 -> a2
forall a. SigSpace a => (Sig -> Sig) -> a -> a
mapSig Sig -> Sig
f a2
a2, (Sig -> Sig) -> a3 -> a3
forall a. SigSpace a => (Sig -> Sig) -> a -> a
mapSig Sig -> Sig
f a3
a3, (Sig -> Sig) -> a4 -> a4
forall a. SigSpace a => (Sig -> Sig) -> a -> a
mapSig Sig -> Sig
f a4
a4, (Sig -> Sig) -> a5 -> a5
forall a. SigSpace a => (Sig -> Sig) -> a -> a
mapSig Sig -> Sig
f a5
a5)
instance (BindSig a1, BindSig a2, BindSig a3, BindSig a4, BindSig a5) => BindSig  (a1, a2, a3, a4, a5) where bindSig :: (Sig -> SE Sig) -> (a1, a2, a3, a4, a5) -> SE (a1, a2, a3, a4, a5)
bindSig Sig -> SE Sig
f (a1
a1, a2
a2, a3
a3, a4
a4, a5
a5) = (,,,,) (a1 -> a2 -> a3 -> a4 -> a5 -> (a1, a2, a3, a4, a5))
-> SE a1 -> SE (a2 -> a3 -> a4 -> a5 -> (a1, a2, a3, a4, a5))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Sig -> SE Sig) -> a1 -> SE a1
forall a. BindSig a => (Sig -> SE Sig) -> a -> SE a
bindSig Sig -> SE Sig
f a1
a1 SE (a2 -> a3 -> a4 -> a5 -> (a1, a2, a3, a4, a5))
-> SE a2 -> SE (a3 -> a4 -> a5 -> (a1, a2, a3, a4, a5))
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig -> SE Sig) -> a2 -> SE a2
forall a. BindSig a => (Sig -> SE Sig) -> a -> SE a
bindSig Sig -> SE Sig
f a2
a2 SE (a3 -> a4 -> a5 -> (a1, a2, a3, a4, a5))
-> SE a3 -> SE (a4 -> a5 -> (a1, a2, a3, a4, a5))
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig -> SE Sig) -> a3 -> SE a3
forall a. BindSig a => (Sig -> SE Sig) -> a -> SE a
bindSig Sig -> SE Sig
f a3
a3 SE (a4 -> a5 -> (a1, a2, a3, a4, a5))
-> SE a4 -> SE (a5 -> (a1, a2, a3, a4, a5))
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig -> SE Sig) -> a4 -> SE a4
forall a. BindSig a => (Sig -> SE Sig) -> a -> SE a
bindSig Sig -> SE Sig
f a4
a4 SE (a5 -> (a1, a2, a3, a4, a5)) -> SE a5 -> SE (a1, a2, a3, a4, a5)
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig -> SE Sig) -> a5 -> SE a5
forall a. BindSig a => (Sig -> SE Sig) -> a -> SE a
bindSig Sig -> SE Sig
f a5
a5

instance (SigSpace a1, SigSpace a2, SigSpace a3, SigSpace a4, SigSpace a5, SigSpace a6) => SigSpace (a1, a2, a3, a4, a5, a6) where mapSig :: (Sig -> Sig)
-> (a1, a2, a3, a4, a5, a6) -> (a1, a2, a3, a4, a5, a6)
mapSig  Sig -> Sig
f (a1
a1, a2
a2, a3
a3, a4
a4, a5
a5, a6
a6) = ((Sig -> Sig) -> a1 -> a1
forall a. SigSpace a => (Sig -> Sig) -> a -> a
mapSig Sig -> Sig
f a1
a1, (Sig -> Sig) -> a2 -> a2
forall a. SigSpace a => (Sig -> Sig) -> a -> a
mapSig Sig -> Sig
f a2
a2, (Sig -> Sig) -> a3 -> a3
forall a. SigSpace a => (Sig -> Sig) -> a -> a
mapSig Sig -> Sig
f a3
a3, (Sig -> Sig) -> a4 -> a4
forall a. SigSpace a => (Sig -> Sig) -> a -> a
mapSig Sig -> Sig
f a4
a4, (Sig -> Sig) -> a5 -> a5
forall a. SigSpace a => (Sig -> Sig) -> a -> a
mapSig Sig -> Sig
f a5
a5, (Sig -> Sig) -> a6 -> a6
forall a. SigSpace a => (Sig -> Sig) -> a -> a
mapSig Sig -> Sig
f a6
a6)
instance (BindSig a1, BindSig a2, BindSig a3, BindSig a4, BindSig a5, BindSig a6) => BindSig  (a1, a2, a3, a4, a5, a6) where bindSig :: (Sig -> SE Sig)
-> (a1, a2, a3, a4, a5, a6) -> SE (a1, a2, a3, a4, a5, a6)
bindSig Sig -> SE Sig
f (a1
a1, a2
a2, a3
a3, a4
a4, a5
a5, a6
a6) = (,,,,,) (a1 -> a2 -> a3 -> a4 -> a5 -> a6 -> (a1, a2, a3, a4, a5, a6))
-> SE a1
-> SE (a2 -> a3 -> a4 -> a5 -> a6 -> (a1, a2, a3, a4, a5, a6))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Sig -> SE Sig) -> a1 -> SE a1
forall a. BindSig a => (Sig -> SE Sig) -> a -> SE a
bindSig Sig -> SE Sig
f a1
a1 SE (a2 -> a3 -> a4 -> a5 -> a6 -> (a1, a2, a3, a4, a5, a6))
-> SE a2 -> SE (a3 -> a4 -> a5 -> a6 -> (a1, a2, a3, a4, a5, a6))
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig -> SE Sig) -> a2 -> SE a2
forall a. BindSig a => (Sig -> SE Sig) -> a -> SE a
bindSig Sig -> SE Sig
f a2
a2 SE (a3 -> a4 -> a5 -> a6 -> (a1, a2, a3, a4, a5, a6))
-> SE a3 -> SE (a4 -> a5 -> a6 -> (a1, a2, a3, a4, a5, a6))
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig -> SE Sig) -> a3 -> SE a3
forall a. BindSig a => (Sig -> SE Sig) -> a -> SE a
bindSig Sig -> SE Sig
f a3
a3 SE (a4 -> a5 -> a6 -> (a1, a2, a3, a4, a5, a6))
-> SE a4 -> SE (a5 -> a6 -> (a1, a2, a3, a4, a5, a6))
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig -> SE Sig) -> a4 -> SE a4
forall a. BindSig a => (Sig -> SE Sig) -> a -> SE a
bindSig Sig -> SE Sig
f a4
a4 SE (a5 -> a6 -> (a1, a2, a3, a4, a5, a6))
-> SE a5 -> SE (a6 -> (a1, a2, a3, a4, a5, a6))
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig -> SE Sig) -> a5 -> SE a5
forall a. BindSig a => (Sig -> SE Sig) -> a -> SE a
bindSig Sig -> SE Sig
f a5
a5 SE (a6 -> (a1, a2, a3, a4, a5, a6))
-> SE a6 -> SE (a1, a2, a3, a4, a5, a6)
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig -> SE Sig) -> a6 -> SE a6
forall a. BindSig a => (Sig -> SE Sig) -> a -> SE a
bindSig Sig -> SE Sig
f a6
a6

instance (SigSpace a1, SigSpace a2, SigSpace a3, SigSpace a4, SigSpace a5, SigSpace a6, SigSpace a7) => SigSpace (a1, a2, a3, a4, a5, a6, a7) where mapSig :: (Sig -> Sig)
-> (a1, a2, a3, a4, a5, a6, a7) -> (a1, a2, a3, a4, a5, a6, a7)
mapSig  Sig -> Sig
f (a1
a1, a2
a2, a3
a3, a4
a4, a5
a5, a6
a6, a7
a7) = ((Sig -> Sig) -> a1 -> a1
forall a. SigSpace a => (Sig -> Sig) -> a -> a
mapSig Sig -> Sig
f a1
a1, (Sig -> Sig) -> a2 -> a2
forall a. SigSpace a => (Sig -> Sig) -> a -> a
mapSig Sig -> Sig
f a2
a2, (Sig -> Sig) -> a3 -> a3
forall a. SigSpace a => (Sig -> Sig) -> a -> a
mapSig Sig -> Sig
f a3
a3, (Sig -> Sig) -> a4 -> a4
forall a. SigSpace a => (Sig -> Sig) -> a -> a
mapSig Sig -> Sig
f a4
a4, (Sig -> Sig) -> a5 -> a5
forall a. SigSpace a => (Sig -> Sig) -> a -> a
mapSig Sig -> Sig
f a5
a5, (Sig -> Sig) -> a6 -> a6
forall a. SigSpace a => (Sig -> Sig) -> a -> a
mapSig Sig -> Sig
f a6
a6, (Sig -> Sig) -> a7 -> a7
forall a. SigSpace a => (Sig -> Sig) -> a -> a
mapSig Sig -> Sig
f a7
a7)
instance (BindSig a1, BindSig a2, BindSig a3, BindSig a4, BindSig a5, BindSig a6, BindSig a7) => BindSig  (a1, a2, a3, a4, a5, a6, a7) where bindSig :: (Sig -> SE Sig)
-> (a1, a2, a3, a4, a5, a6, a7) -> SE (a1, a2, a3, a4, a5, a6, a7)
bindSig Sig -> SE Sig
f (a1
a1, a2
a2, a3
a3, a4
a4, a5
a5, a6
a6, a7
a7) = (,,,,,,) (a1
 -> a2
 -> a3
 -> a4
 -> a5
 -> a6
 -> a7
 -> (a1, a2, a3, a4, a5, a6, a7))
-> SE a1
-> SE
     (a2 -> a3 -> a4 -> a5 -> a6 -> a7 -> (a1, a2, a3, a4, a5, a6, a7))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Sig -> SE Sig) -> a1 -> SE a1
forall a. BindSig a => (Sig -> SE Sig) -> a -> SE a
bindSig Sig -> SE Sig
f a1
a1 SE
  (a2 -> a3 -> a4 -> a5 -> a6 -> a7 -> (a1, a2, a3, a4, a5, a6, a7))
-> SE a2
-> SE (a3 -> a4 -> a5 -> a6 -> a7 -> (a1, a2, a3, a4, a5, a6, a7))
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig -> SE Sig) -> a2 -> SE a2
forall a. BindSig a => (Sig -> SE Sig) -> a -> SE a
bindSig Sig -> SE Sig
f a2
a2 SE (a3 -> a4 -> a5 -> a6 -> a7 -> (a1, a2, a3, a4, a5, a6, a7))
-> SE a3
-> SE (a4 -> a5 -> a6 -> a7 -> (a1, a2, a3, a4, a5, a6, a7))
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig -> SE Sig) -> a3 -> SE a3
forall a. BindSig a => (Sig -> SE Sig) -> a -> SE a
bindSig Sig -> SE Sig
f a3
a3 SE (a4 -> a5 -> a6 -> a7 -> (a1, a2, a3, a4, a5, a6, a7))
-> SE a4 -> SE (a5 -> a6 -> a7 -> (a1, a2, a3, a4, a5, a6, a7))
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig -> SE Sig) -> a4 -> SE a4
forall a. BindSig a => (Sig -> SE Sig) -> a -> SE a
bindSig Sig -> SE Sig
f a4
a4 SE (a5 -> a6 -> a7 -> (a1, a2, a3, a4, a5, a6, a7))
-> SE a5 -> SE (a6 -> a7 -> (a1, a2, a3, a4, a5, a6, a7))
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig -> SE Sig) -> a5 -> SE a5
forall a. BindSig a => (Sig -> SE Sig) -> a -> SE a
bindSig Sig -> SE Sig
f a5
a5 SE (a6 -> a7 -> (a1, a2, a3, a4, a5, a6, a7))
-> SE a6 -> SE (a7 -> (a1, a2, a3, a4, a5, a6, a7))
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig -> SE Sig) -> a6 -> SE a6
forall a. BindSig a => (Sig -> SE Sig) -> a -> SE a
bindSig Sig -> SE Sig
f a6
a6 SE (a7 -> (a1, a2, a3, a4, a5, a6, a7))
-> SE a7 -> SE (a1, a2, a3, a4, a5, a6, a7)
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig -> SE Sig) -> a7 -> SE a7
forall a. BindSig a => (Sig -> SE Sig) -> a -> SE a
bindSig Sig -> SE Sig
f a7
a7

instance (SigSpace a1, SigSpace a2, SigSpace a3, SigSpace a4, SigSpace a5, SigSpace a6, SigSpace a7, SigSpace a8) => SigSpace (a1, a2, a3, a4, a5, a6, a7, a8) where mapSig :: (Sig -> Sig)
-> (a1, a2, a3, a4, a5, a6, a7, a8)
-> (a1, a2, a3, a4, a5, a6, a7, a8)
mapSig  Sig -> Sig
f (a1
a1, a2
a2, a3
a3, a4
a4, a5
a5, a6
a6, a7
a7, a8
a8) = ((Sig -> Sig) -> a1 -> a1
forall a. SigSpace a => (Sig -> Sig) -> a -> a
mapSig Sig -> Sig
f a1
a1, (Sig -> Sig) -> a2 -> a2
forall a. SigSpace a => (Sig -> Sig) -> a -> a
mapSig Sig -> Sig
f a2
a2, (Sig -> Sig) -> a3 -> a3
forall a. SigSpace a => (Sig -> Sig) -> a -> a
mapSig Sig -> Sig
f a3
a3, (Sig -> Sig) -> a4 -> a4
forall a. SigSpace a => (Sig -> Sig) -> a -> a
mapSig Sig -> Sig
f a4
a4, (Sig -> Sig) -> a5 -> a5
forall a. SigSpace a => (Sig -> Sig) -> a -> a
mapSig Sig -> Sig
f a5
a5, (Sig -> Sig) -> a6 -> a6
forall a. SigSpace a => (Sig -> Sig) -> a -> a
mapSig Sig -> Sig
f a6
a6, (Sig -> Sig) -> a7 -> a7
forall a. SigSpace a => (Sig -> Sig) -> a -> a
mapSig Sig -> Sig
f a7
a7, (Sig -> Sig) -> a8 -> a8
forall a. SigSpace a => (Sig -> Sig) -> a -> a
mapSig Sig -> Sig
f a8
a8)
instance (BindSig a1, BindSig a2, BindSig a3, BindSig a4, BindSig a5, BindSig a6, BindSig a7, BindSig a8) => BindSig  (a1, a2, a3, a4, a5, a6, a7, a8) where bindSig :: (Sig -> SE Sig)
-> (a1, a2, a3, a4, a5, a6, a7, a8)
-> SE (a1, a2, a3, a4, a5, a6, a7, a8)
bindSig Sig -> SE Sig
f (a1
a1, a2
a2, a3
a3, a4
a4, a5
a5, a6
a6, a7
a7, a8
a8) = (,,,,,,,) (a1
 -> a2
 -> a3
 -> a4
 -> a5
 -> a6
 -> a7
 -> a8
 -> (a1, a2, a3, a4, a5, a6, a7, a8))
-> SE a1
-> SE
     (a2
      -> a3
      -> a4
      -> a5
      -> a6
      -> a7
      -> a8
      -> (a1, a2, a3, a4, a5, a6, a7, a8))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Sig -> SE Sig) -> a1 -> SE a1
forall a. BindSig a => (Sig -> SE Sig) -> a -> SE a
bindSig Sig -> SE Sig
f a1
a1 SE
  (a2
   -> a3
   -> a4
   -> a5
   -> a6
   -> a7
   -> a8
   -> (a1, a2, a3, a4, a5, a6, a7, a8))
-> SE a2
-> SE
     (a3
      -> a4 -> a5 -> a6 -> a7 -> a8 -> (a1, a2, a3, a4, a5, a6, a7, a8))
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig -> SE Sig) -> a2 -> SE a2
forall a. BindSig a => (Sig -> SE Sig) -> a -> SE a
bindSig Sig -> SE Sig
f a2
a2 SE
  (a3
   -> a4 -> a5 -> a6 -> a7 -> a8 -> (a1, a2, a3, a4, a5, a6, a7, a8))
-> SE a3
-> SE
     (a4 -> a5 -> a6 -> a7 -> a8 -> (a1, a2, a3, a4, a5, a6, a7, a8))
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig -> SE Sig) -> a3 -> SE a3
forall a. BindSig a => (Sig -> SE Sig) -> a -> SE a
bindSig Sig -> SE Sig
f a3
a3 SE (a4 -> a5 -> a6 -> a7 -> a8 -> (a1, a2, a3, a4, a5, a6, a7, a8))
-> SE a4
-> SE (a5 -> a6 -> a7 -> a8 -> (a1, a2, a3, a4, a5, a6, a7, a8))
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig -> SE Sig) -> a4 -> SE a4
forall a. BindSig a => (Sig -> SE Sig) -> a -> SE a
bindSig Sig -> SE Sig
f a4
a4 SE (a5 -> a6 -> a7 -> a8 -> (a1, a2, a3, a4, a5, a6, a7, a8))
-> SE a5 -> SE (a6 -> a7 -> a8 -> (a1, a2, a3, a4, a5, a6, a7, a8))
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig -> SE Sig) -> a5 -> SE a5
forall a. BindSig a => (Sig -> SE Sig) -> a -> SE a
bindSig Sig -> SE Sig
f a5
a5 SE (a6 -> a7 -> a8 -> (a1, a2, a3, a4, a5, a6, a7, a8))
-> SE a6 -> SE (a7 -> a8 -> (a1, a2, a3, a4, a5, a6, a7, a8))
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig -> SE Sig) -> a6 -> SE a6
forall a. BindSig a => (Sig -> SE Sig) -> a -> SE a
bindSig Sig -> SE Sig
f a6
a6 SE (a7 -> a8 -> (a1, a2, a3, a4, a5, a6, a7, a8))
-> SE a7 -> SE (a8 -> (a1, a2, a3, a4, a5, a6, a7, a8))
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig -> SE Sig) -> a7 -> SE a7
forall a. BindSig a => (Sig -> SE Sig) -> a -> SE a
bindSig Sig -> SE Sig
f a7
a7 SE (a8 -> (a1, a2, a3, a4, a5, a6, a7, a8))
-> SE a8 -> SE (a1, a2, a3, a4, a5, a6, a7, a8)
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig -> SE Sig) -> a8 -> SE a8
forall a. BindSig a => (Sig -> SE Sig) -> a -> SE a
bindSig Sig -> SE Sig
f a8
a8

instance {-# OVERLAPPABLE #-} SigSpace a => SigSpace (SE a) where  mapSig :: (Sig -> Sig) -> SE a -> SE a
mapSig  Sig -> Sig
f = (a -> a) -> SE a -> SE a
forall a b. (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((Sig -> Sig) -> a -> a
forall a. SigSpace a => (Sig -> Sig) -> a -> a
mapSig Sig -> Sig
f)
instance {-# OVERLAPPABLE #-} BindSig a  => BindSig  (SE a) where  bindSig :: (Sig -> SE Sig) -> SE a -> SE (SE a)
bindSig Sig -> SE Sig
f = (a -> SE a) -> SE a -> SE (SE a)
forall a b. (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((Sig -> SE Sig) -> a -> SE a
forall a. BindSig a => (Sig -> SE Sig) -> a -> SE a
bindSig Sig -> SE Sig
f)
#endif

#if __GLASGOW_HASKELL__ < 710

instance SigSpace (Sig, Sig) where  mapSig  f (a1, a2) = (mapSig f a1, mapSig f a2)
instance BindSig  (Sig, Sig) where  bindSig f (a1, a2) = (,) <$> bindSig f a1 <*> bindSig f a2

instance SigSpace (Sig, Sig, Sig) where mapSig  f (a1, a2, a3) = (mapSig f a1, mapSig f a2, mapSig f a3)
instance BindSig  (Sig, Sig, Sig) where bindSig f (a1, a2, a3) = (,,) <$> bindSig f a1 <*> bindSig f a2 <*> bindSig f a3

instance SigSpace (Sig, Sig, Sig, Sig) where mapSig  f (a1, a2, a3, a4) = (mapSig f a1, mapSig f a2, mapSig f a3, mapSig f a4)
instance BindSig  (Sig, Sig, Sig, Sig) where bindSig f (a1, a2, a3, a4) = (,,,) <$> bindSig f a1 <*> bindSig f a2 <*> bindSig f a3 <*> bindSig f a4

instance SigSpace (Sig, Sig, Sig, Sig, Sig) where mapSig  f (a1, a2, a3, a4, a5) = (mapSig f a1, mapSig f a2, mapSig f a3, mapSig f a4, mapSig f a5)
instance BindSig  (Sig, Sig, Sig, Sig, Sig) where bindSig f (a1, a2, a3, a4, a5) = (,,,,) <$> bindSig f a1 <*> bindSig f a2 <*> bindSig f a3 <*> bindSig f a4 <*> bindSig f a5

instance SigSpace (Sig, Sig, Sig, Sig, Sig, Sig) where mapSig  f (a1, a2, a3, a4, a5, a6) = (mapSig f a1, mapSig f a2, mapSig f a3, mapSig f a4, mapSig f a5, mapSig f a6)
instance BindSig  (Sig, Sig, Sig, Sig, Sig, Sig) where bindSig f (a1, a2, a3, a4, a5, a6) = (,,,,,) <$> bindSig f a1 <*> bindSig f a2 <*> bindSig f a3 <*> bindSig f a4 <*> bindSig f a5 <*> bindSig f a6

instance SigSpace (Sig, Sig, Sig, Sig, Sig, Sig, Sig) where mapSig  f (a1, a2, a3, a4, a5, a6, a7) = (mapSig f a1, mapSig f a2, mapSig f a3, mapSig f a4, mapSig f a5, mapSig f a6, mapSig f a7)
instance BindSig  (Sig, Sig, Sig, Sig, Sig, Sig, Sig) where bindSig f (a1, a2, a3, a4, a5, a6, a7) = (,,,,,,) <$> bindSig f a1 <*> bindSig f a2 <*> bindSig f a3 <*> bindSig f a4 <*> bindSig f a5 <*> bindSig f a6 <*> bindSig f a7

instance SigSpace (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig) where mapSig  f (a1, a2, a3, a4, a5, a6, a7, a8) = (mapSig f a1, mapSig f a2, mapSig f a3, mapSig f a4, mapSig f a5, mapSig f a6, mapSig f a7, mapSig f a8)
instance BindSig  (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig) where bindSig f (a1, a2, a3, a4, a5, a6, a7, a8) = (,,,,,,,) <$> bindSig f a1 <*> bindSig f a2 <*> bindSig f a3 <*> bindSig f a4 <*> bindSig f a5 <*> bindSig f a6 <*> bindSig f a7 <*> bindSig f a8

instance SigSpace (SE Sig) where  mapSig  f = fmap (mapSig f)
instance BindSig  (SE Sig) where  bindSig f = fmap (bindSig f)

instance SigSpace (SE (Sig, Sig)) where  mapSig  f = fmap (mapSig f)
instance BindSig  (SE (Sig, Sig)) where  bindSig f = fmap (bindSig f)

instance SigSpace (SE (Sig, Sig, Sig)) where  mapSig  f = fmap (mapSig f)
instance BindSig  (SE (Sig, Sig, Sig)) where  bindSig f = fmap (bindSig f)

instance SigSpace (SE (Sig, Sig, Sig, Sig)) where  mapSig  f = fmap (mapSig f)
instance BindSig  (SE (Sig, Sig, Sig, Sig)) where  bindSig f = fmap (bindSig f)

instance SigSpace (SE (Sig, Sig, Sig, Sig, Sig)) where  mapSig  f = fmap (mapSig f)
instance BindSig  (SE (Sig, Sig, Sig, Sig, Sig)) where  bindSig f = fmap (bindSig f)

instance SigSpace (SE (Sig, Sig, Sig, Sig, Sig, Sig)) where  mapSig  f = fmap (mapSig f)
instance BindSig  (SE (Sig, Sig, Sig, Sig, Sig, Sig)) where  bindSig f = fmap (bindSig f)

instance SigSpace (SE (Sig, Sig, Sig, Sig, Sig, Sig, Sig)) where  mapSig  f = fmap (mapSig f)
instance BindSig  (SE (Sig, Sig, Sig, Sig, Sig, Sig, Sig)) where  bindSig f = fmap (bindSig f)

instance SigSpace (SE (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)) where  mapSig  f = fmap (mapSig f)
instance BindSig  (SE (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)) where  bindSig f = fmap (bindSig f)
#endif

----------------------------------------------------------------------------------------------------------

-- | Converts stereosignal to mono with function mean.
toMono :: (Sig, Sig) -> Sig
toMono :: Sig2 -> Sig
toMono (Sig
a, Sig
b) = Sig
0.5 Sig -> Sig -> Sig
forall a. Num a => a -> a -> a
* Sig
a Sig -> Sig -> Sig
forall a. Num a => a -> a -> a
+ Sig
0.5 Sig -> Sig -> Sig
forall a. Num a => a -> a -> a
* Sig
b

instance SigSpace2 Sig   where  mapSig2 :: (Sig2 -> Sig2) -> Sig -> Sig
mapSig2  Sig2 -> Sig2
f Sig
a = Sig2 -> Sig
toMono (Sig2 -> Sig) -> Sig2 -> Sig
forall a b. (a -> b) -> a -> b
$ Sig2 -> Sig2
f (Sig
a, Sig
a)
instance BindSig2  Sig   where  bindSig2 :: (Sig2 -> SE Sig2) -> Sig -> SE Sig
bindSig2 Sig2 -> SE Sig2
f Sig
a = (Sig2 -> Sig) -> SE Sig2 -> SE Sig
forall a b. (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Sig2 -> Sig
toMono (SE Sig2 -> SE Sig) -> SE Sig2 -> SE Sig
forall a b. (a -> b) -> a -> b
$ Sig2 -> SE Sig2
f (Sig
a, Sig
a)

instance SigSpace2 (Sig, Sig) where  mapSig2 :: (Sig2 -> Sig2) -> Sig2 -> Sig2
mapSig2  = (Sig2 -> Sig2) -> Sig2 -> Sig2
forall a. a -> a
id
instance BindSig2  (Sig, Sig) where  bindSig2 :: (Sig2 -> SE Sig2) -> Sig2 -> SE Sig2
bindSig2 = (Sig2 -> SE Sig2) -> Sig2 -> SE Sig2
forall a. a -> a
id

instance SigSpace2 (Sig, Sig, Sig) where
    mapSig2 :: (Sig2 -> Sig2) -> (Sig, Sig, Sig) -> (Sig, Sig, Sig)
mapSig2  Sig2 -> Sig2
f (Sig
a1, Sig
a2, Sig
a3) = (Sig
b1, Sig
b2, Sig2 -> Sig
toMono (Sig
b3, Sig
b4))
        where
            (Sig
b1, Sig
b2, Sig
b3, Sig
b4) = (Sig2 -> Sig2) -> (Sig, Sig, Sig, Sig) -> (Sig, Sig, Sig, Sig)
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f (Sig
a1, Sig
a2, Sig
a3, Sig
a4)
            a4 :: Sig
a4 = Sig
a3

instance BindSig2  (Sig, Sig, Sig) where
    bindSig2 :: (Sig2 -> SE Sig2) -> (Sig, Sig, Sig) -> SE (Sig, Sig, Sig)
bindSig2 Sig2 -> SE Sig2
f (Sig
a1, Sig
a2, Sig
a3) = do
        (Sig
b1, Sig
b2, Sig
b3, Sig
b4) <- (Sig2 -> SE Sig2)
-> (Sig, Sig, Sig, Sig) -> SE (Sig, Sig, Sig, Sig)
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f (Sig
a1, Sig
a2, Sig
a3, Sig
a4)
        (Sig, Sig, Sig) -> SE (Sig, Sig, Sig)
forall a. a -> SE a
forall (m :: * -> *) a. Monad m => a -> m a
return (Sig
b1, Sig
b2, Sig2 -> Sig
toMono (Sig
b3, Sig
b4))
        where
            a4 :: Sig
a4 = Sig
a3

instance SigSpace2 (Sig, Sig, Sig, Sig) where
    mapSig2 :: (Sig2 -> Sig2) -> (Sig, Sig, Sig, Sig) -> (Sig, Sig, Sig, Sig)
mapSig2  Sig2 -> Sig2
f (Sig
a1, Sig
a2, Sig
a3, Sig
a4) = (Sig
b1, Sig
b2, Sig
b3, Sig
b4)
        where
            (Sig
b1, Sig
b2) = Sig2 -> Sig2
f (Sig
a1, Sig
a2)
            (Sig
b3, Sig
b4) = Sig2 -> Sig2
f (Sig
a3, Sig
a4)

instance BindSig2  (Sig, Sig, Sig, Sig) where
    bindSig2 :: (Sig2 -> SE Sig2)
-> (Sig, Sig, Sig, Sig) -> SE (Sig, Sig, Sig, Sig)
bindSig2 Sig2 -> SE Sig2
f (Sig
a1, Sig
a2, Sig
a3, Sig
a4) = do
            (Sig
b1, Sig
b2) <- Sig2 -> SE Sig2
f (Sig
a1, Sig
a2)
            (Sig
b3, Sig
b4) <- Sig2 -> SE Sig2
f (Sig
a3, Sig
a4)
            (Sig, Sig, Sig, Sig) -> SE (Sig, Sig, Sig, Sig)
forall a. a -> SE a
forall (m :: * -> *) a. Monad m => a -> m a
return (Sig
b1, Sig
b2, Sig
b3, Sig
b4)

instance SigSpace2 (Sig, Sig, Sig, Sig, Sig) where
    mapSig2 :: (Sig2 -> Sig2)
-> (Sig, Sig, Sig, Sig, Sig) -> (Sig, Sig, Sig, Sig, Sig)
mapSig2  Sig2 -> Sig2
f (Sig
a1, Sig
a2, Sig
a3, Sig
a4, Sig
a5) = (Sig
b1, Sig
b2, Sig
b3, Sig
b4, Sig2 -> Sig
toMono (Sig
b5, Sig
b6))
        where
            (Sig
b1, Sig
b2, Sig
b3, Sig
b4, Sig
b5, Sig
b6) = (Sig2 -> Sig2)
-> (Sig, Sig, Sig, Sig, Sig, Sig) -> (Sig, Sig, Sig, Sig, Sig, Sig)
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f (Sig
a1, Sig
a2, Sig
a3, Sig
a4, Sig
a5, Sig
a6)
            a6 :: Sig
a6 = Sig
a5

instance BindSig2 (Sig, Sig, Sig, Sig, Sig) where
    bindSig2 :: (Sig2 -> SE Sig2)
-> (Sig, Sig, Sig, Sig, Sig) -> SE (Sig, Sig, Sig, Sig, Sig)
bindSig2 Sig2 -> SE Sig2
f (Sig
a1, Sig
a2, Sig
a3, Sig
a4, Sig
a5) = do
        (Sig
b1, Sig
b2, Sig
b3, Sig
b4, Sig
b5, Sig
b6) <- (Sig2 -> SE Sig2)
-> (Sig, Sig, Sig, Sig, Sig, Sig)
-> SE (Sig, Sig, Sig, Sig, Sig, Sig)
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f (Sig
a1, Sig
a2, Sig
a3, Sig
a4, Sig
a5, Sig
a6)
        (Sig, Sig, Sig, Sig, Sig) -> SE (Sig, Sig, Sig, Sig, Sig)
forall a. a -> SE a
forall (m :: * -> *) a. Monad m => a -> m a
return (Sig
b1, Sig
b2, Sig
b3, Sig
b4, Sig2 -> Sig
toMono (Sig
b5, Sig
b6))
        where
            a6 :: Sig
a6 = Sig
a5

instance SigSpace2 (Sig, Sig, Sig, Sig, Sig, Sig) where
    mapSig2 :: (Sig2 -> Sig2)
-> (Sig, Sig, Sig, Sig, Sig, Sig) -> (Sig, Sig, Sig, Sig, Sig, Sig)
mapSig2  Sig2 -> Sig2
f (Sig
a1, Sig
a2, Sig
a3, Sig
a4, Sig
a5, Sig
a6) = (Sig
b1, Sig
b2, Sig
b3, Sig
b4, Sig
b5, Sig
b6)
        where
            (Sig
b1, Sig
b2, Sig
b3, Sig
b4) = (Sig2 -> Sig2) -> (Sig, Sig, Sig, Sig) -> (Sig, Sig, Sig, Sig)
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f (Sig
a1, Sig
a2, Sig
a3, Sig
a4)
            (Sig
b5, Sig
b6) = Sig2 -> Sig2
f (Sig
a5, Sig
a6)

instance BindSig2  (Sig, Sig, Sig, Sig, Sig, Sig) where
    bindSig2 :: (Sig2 -> SE Sig2)
-> (Sig, Sig, Sig, Sig, Sig, Sig)
-> SE (Sig, Sig, Sig, Sig, Sig, Sig)
bindSig2 Sig2 -> SE Sig2
f (Sig
a1, Sig
a2, Sig
a3, Sig
a4, Sig
a5, Sig
a6) = do
        (Sig
b1, Sig
b2, Sig
b3, Sig
b4) <- (Sig2 -> SE Sig2)
-> (Sig, Sig, Sig, Sig) -> SE (Sig, Sig, Sig, Sig)
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f (Sig
a1, Sig
a2, Sig
a3, Sig
a4)
        (Sig
b5, Sig
b6) <- Sig2 -> SE Sig2
f (Sig
a5, Sig
a6)
        (Sig, Sig, Sig, Sig, Sig, Sig) -> SE (Sig, Sig, Sig, Sig, Sig, Sig)
forall a. a -> SE a
forall (m :: * -> *) a. Monad m => a -> m a
return (Sig
b1, Sig
b2, Sig
b3, Sig
b4, Sig
b5, Sig
b6)

instance SigSpace2 (Sig, Sig, Sig, Sig, Sig, Sig, Sig) where
    mapSig2 :: (Sig2 -> Sig2)
-> (Sig, Sig, Sig, Sig, Sig, Sig, Sig)
-> (Sig, Sig, Sig, Sig, Sig, Sig, Sig)
mapSig2  Sig2 -> Sig2
f (Sig
a1, Sig
a2, Sig
a3, Sig
a4, Sig
a5, Sig
a6, Sig
a7) = (Sig
b1, Sig
b2, Sig
b3, Sig
b4, Sig
b5, Sig
b6, Sig2 -> Sig
toMono (Sig
b7, Sig
b8))
        where
            (Sig
b1, Sig
b2, Sig
b3, Sig
b4, Sig
b5, Sig
b6, Sig
b7, Sig
b8) = (Sig2 -> Sig2)
-> (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
-> (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f (Sig
a1, Sig
a2, Sig
a3, Sig
a4, Sig
a5, Sig
a6, Sig
a7, Sig
a8)
            a8 :: Sig
a8 = Sig
a7

instance BindSig2  (Sig, Sig, Sig, Sig, Sig, Sig, Sig) where
    bindSig2 :: (Sig2 -> SE Sig2)
-> (Sig, Sig, Sig, Sig, Sig, Sig, Sig)
-> SE (Sig, Sig, Sig, Sig, Sig, Sig, Sig)
bindSig2 Sig2 -> SE Sig2
f (Sig
a1, Sig
a2, Sig
a3, Sig
a4, Sig
a5, Sig
a6, Sig
a7) = do
        (Sig
b1, Sig
b2, Sig
b3, Sig
b4, Sig
b5, Sig
b6, Sig
b7, Sig
b8) <- (Sig2 -> SE Sig2)
-> (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
-> SE (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f (Sig
a1, Sig
a2, Sig
a3, Sig
a4, Sig
a5, Sig
a6, Sig
a7, Sig
a8)
        (Sig, Sig, Sig, Sig, Sig, Sig, Sig)
-> SE (Sig, Sig, Sig, Sig, Sig, Sig, Sig)
forall a. a -> SE a
forall (m :: * -> *) a. Monad m => a -> m a
return (Sig
b1, Sig
b2, Sig
b3, Sig
b4, Sig
b5, Sig
b6, Sig2 -> Sig
toMono (Sig
b7, Sig
b8))
        where
            a8 :: Sig
a8 = Sig
a7

instance SigSpace2 (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig) where
    mapSig2 :: (Sig2 -> Sig2)
-> (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
-> (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
mapSig2  Sig2 -> Sig2
f (Sig
a1, Sig
a2, Sig
a3, Sig
a4, Sig
a5, Sig
a6, Sig
a7, Sig
a8) = (Sig
b1, Sig
b2, Sig
b3, Sig
b4, Sig
b5, Sig
b6, Sig
b7, Sig
b8)
        where
            (Sig
b1, Sig
b2, Sig
b3, Sig
b4, Sig
b5, Sig
b6) = (Sig2 -> Sig2)
-> (Sig, Sig, Sig, Sig, Sig, Sig) -> (Sig, Sig, Sig, Sig, Sig, Sig)
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f (Sig
a1, Sig
a2, Sig
a3, Sig
a4, Sig
a5, Sig
a6)
            (Sig
b7, Sig
b8) = Sig2 -> Sig2
f (Sig
a7, Sig
a8)

instance BindSig2  (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig) where
    bindSig2 :: (Sig2 -> SE Sig2)
-> (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
-> SE (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
bindSig2 Sig2 -> SE Sig2
f (Sig
a1, Sig
a2, Sig
a3, Sig
a4, Sig
a5, Sig
a6, Sig
a7, Sig
a8) = do
        (Sig
b1, Sig
b2, Sig
b3, Sig
b4, Sig
b5, Sig
b6) <- (Sig2 -> SE Sig2)
-> (Sig, Sig, Sig, Sig, Sig, Sig)
-> SE (Sig, Sig, Sig, Sig, Sig, Sig)
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f (Sig
a1, Sig
a2, Sig
a3, Sig
a4, Sig
a5, Sig
a6)
        (Sig
b7, Sig
b8) <- Sig2 -> SE Sig2
f (Sig
a7, Sig
a8)
        (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
-> SE (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
forall a. a -> SE a
forall (m :: * -> *) a. Monad m => a -> m a
return (Sig
b1, Sig
b2, Sig
b3, Sig
b4, Sig
b5, Sig
b6, Sig
b7, Sig
b8)

instance SigSpace2 (Sig2, Sig2) where  mapSig2 :: (Sig2 -> Sig2) -> (Sig2, Sig2) -> (Sig2, Sig2)
mapSig2  Sig2 -> Sig2
f (Sig2
a1, Sig2
a2) = ((Sig2 -> Sig2) -> Sig2 -> Sig2
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f Sig2
a1, (Sig2 -> Sig2) -> Sig2 -> Sig2
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f Sig2
a2)
instance BindSig2  (Sig2, Sig2) where  bindSig2 :: (Sig2 -> SE Sig2) -> (Sig2, Sig2) -> SE (Sig2, Sig2)
bindSig2 Sig2 -> SE Sig2
f (Sig2
a1, Sig2
a2) = (,) (Sig2 -> Sig2 -> (Sig2, Sig2))
-> SE Sig2 -> SE (Sig2 -> (Sig2, Sig2))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Sig2 -> SE Sig2) -> Sig2 -> SE Sig2
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f Sig2
a1 SE (Sig2 -> (Sig2, Sig2)) -> SE Sig2 -> SE (Sig2, Sig2)
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig2 -> SE Sig2) -> Sig2 -> SE Sig2
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f Sig2
a2

instance SigSpace2 (Sig2, Sig2, Sig2) where  mapSig2 :: (Sig2 -> Sig2) -> (Sig2, Sig2, Sig2) -> (Sig2, Sig2, Sig2)
mapSig2  Sig2 -> Sig2
f (Sig2
a1, Sig2
a2, Sig2
a3) = ((Sig2 -> Sig2) -> Sig2 -> Sig2
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f Sig2
a1, (Sig2 -> Sig2) -> Sig2 -> Sig2
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f Sig2
a2, (Sig2 -> Sig2) -> Sig2 -> Sig2
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f Sig2
a3)
instance BindSig2  (Sig2, Sig2, Sig2) where  bindSig2 :: (Sig2 -> SE Sig2) -> (Sig2, Sig2, Sig2) -> SE (Sig2, Sig2, Sig2)
bindSig2 Sig2 -> SE Sig2
f (Sig2
a1, Sig2
a2, Sig2
a3) = (,,) (Sig2 -> Sig2 -> Sig2 -> (Sig2, Sig2, Sig2))
-> SE Sig2 -> SE (Sig2 -> Sig2 -> (Sig2, Sig2, Sig2))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Sig2 -> SE Sig2) -> Sig2 -> SE Sig2
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f Sig2
a1 SE (Sig2 -> Sig2 -> (Sig2, Sig2, Sig2))
-> SE Sig2 -> SE (Sig2 -> (Sig2, Sig2, Sig2))
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig2 -> SE Sig2) -> Sig2 -> SE Sig2
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f Sig2
a2 SE (Sig2 -> (Sig2, Sig2, Sig2)) -> SE Sig2 -> SE (Sig2, Sig2, Sig2)
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig2 -> SE Sig2) -> Sig2 -> SE Sig2
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f Sig2
a3

instance SigSpace2 (Sig2, Sig2, Sig2, Sig2) where  mapSig2 :: (Sig2 -> Sig2)
-> (Sig2, Sig2, Sig2, Sig2) -> (Sig2, Sig2, Sig2, Sig2)
mapSig2  Sig2 -> Sig2
f (Sig2
a1, Sig2
a2, Sig2
a3, Sig2
a4) = ((Sig2 -> Sig2) -> Sig2 -> Sig2
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f Sig2
a1, (Sig2 -> Sig2) -> Sig2 -> Sig2
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f Sig2
a2, (Sig2 -> Sig2) -> Sig2 -> Sig2
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f Sig2
a3, (Sig2 -> Sig2) -> Sig2 -> Sig2
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f Sig2
a4)
instance BindSig2  (Sig2, Sig2, Sig2, Sig2) where  bindSig2 :: (Sig2 -> SE Sig2)
-> (Sig2, Sig2, Sig2, Sig2) -> SE (Sig2, Sig2, Sig2, Sig2)
bindSig2 Sig2 -> SE Sig2
f (Sig2
a1, Sig2
a2, Sig2
a3, Sig2
a4) = (,,,) (Sig2 -> Sig2 -> Sig2 -> Sig2 -> (Sig2, Sig2, Sig2, Sig2))
-> SE Sig2 -> SE (Sig2 -> Sig2 -> Sig2 -> (Sig2, Sig2, Sig2, Sig2))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Sig2 -> SE Sig2) -> Sig2 -> SE Sig2
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f Sig2
a1 SE (Sig2 -> Sig2 -> Sig2 -> (Sig2, Sig2, Sig2, Sig2))
-> SE Sig2 -> SE (Sig2 -> Sig2 -> (Sig2, Sig2, Sig2, Sig2))
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig2 -> SE Sig2) -> Sig2 -> SE Sig2
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f Sig2
a2 SE (Sig2 -> Sig2 -> (Sig2, Sig2, Sig2, Sig2))
-> SE Sig2 -> SE (Sig2 -> (Sig2, Sig2, Sig2, Sig2))
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig2 -> SE Sig2) -> Sig2 -> SE Sig2
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f Sig2
a3 SE (Sig2 -> (Sig2, Sig2, Sig2, Sig2))
-> SE Sig2 -> SE (Sig2, Sig2, Sig2, Sig2)
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig2 -> SE Sig2) -> Sig2 -> SE Sig2
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f Sig2
a4

instance SigSpace2 (Sig2, Sig2, Sig2, Sig2, Sig2) where  mapSig2 :: (Sig2 -> Sig2)
-> (Sig2, Sig2, Sig2, Sig2, Sig2) -> (Sig2, Sig2, Sig2, Sig2, Sig2)
mapSig2  Sig2 -> Sig2
f (Sig2
a1, Sig2
a2, Sig2
a3, Sig2
a4, Sig2
a5) = ((Sig2 -> Sig2) -> Sig2 -> Sig2
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f Sig2
a1, (Sig2 -> Sig2) -> Sig2 -> Sig2
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f Sig2
a2, (Sig2 -> Sig2) -> Sig2 -> Sig2
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f Sig2
a3, (Sig2 -> Sig2) -> Sig2 -> Sig2
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f Sig2
a4, (Sig2 -> Sig2) -> Sig2 -> Sig2
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f Sig2
a5)
instance BindSig2  (Sig2, Sig2, Sig2, Sig2, Sig2) where  bindSig2 :: (Sig2 -> SE Sig2)
-> (Sig2, Sig2, Sig2, Sig2, Sig2)
-> SE (Sig2, Sig2, Sig2, Sig2, Sig2)
bindSig2 Sig2 -> SE Sig2
f (Sig2
a1, Sig2
a2, Sig2
a3, Sig2
a4, Sig2
a5) = (,,,,) (Sig2
 -> Sig2 -> Sig2 -> Sig2 -> Sig2 -> (Sig2, Sig2, Sig2, Sig2, Sig2))
-> SE Sig2
-> SE
     (Sig2 -> Sig2 -> Sig2 -> Sig2 -> (Sig2, Sig2, Sig2, Sig2, Sig2))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Sig2 -> SE Sig2) -> Sig2 -> SE Sig2
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f Sig2
a1 SE (Sig2 -> Sig2 -> Sig2 -> Sig2 -> (Sig2, Sig2, Sig2, Sig2, Sig2))
-> SE Sig2
-> SE (Sig2 -> Sig2 -> Sig2 -> (Sig2, Sig2, Sig2, Sig2, Sig2))
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig2 -> SE Sig2) -> Sig2 -> SE Sig2
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f Sig2
a2 SE (Sig2 -> Sig2 -> Sig2 -> (Sig2, Sig2, Sig2, Sig2, Sig2))
-> SE Sig2 -> SE (Sig2 -> Sig2 -> (Sig2, Sig2, Sig2, Sig2, Sig2))
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig2 -> SE Sig2) -> Sig2 -> SE Sig2
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f Sig2
a3 SE (Sig2 -> Sig2 -> (Sig2, Sig2, Sig2, Sig2, Sig2))
-> SE Sig2 -> SE (Sig2 -> (Sig2, Sig2, Sig2, Sig2, Sig2))
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig2 -> SE Sig2) -> Sig2 -> SE Sig2
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f Sig2
a4 SE (Sig2 -> (Sig2, Sig2, Sig2, Sig2, Sig2))
-> SE Sig2 -> SE (Sig2, Sig2, Sig2, Sig2, Sig2)
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig2 -> SE Sig2) -> Sig2 -> SE Sig2
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f Sig2
a5

instance SigSpace2 (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2) where  mapSig2 :: (Sig2 -> Sig2)
-> (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2)
-> (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2)
mapSig2  Sig2 -> Sig2
f (Sig2
a1, Sig2
a2, Sig2
a3, Sig2
a4, Sig2
a5, Sig2
a6) = ((Sig2 -> Sig2) -> Sig2 -> Sig2
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f Sig2
a1, (Sig2 -> Sig2) -> Sig2 -> Sig2
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f Sig2
a2, (Sig2 -> Sig2) -> Sig2 -> Sig2
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f Sig2
a3, (Sig2 -> Sig2) -> Sig2 -> Sig2
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f Sig2
a4, (Sig2 -> Sig2) -> Sig2 -> Sig2
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f Sig2
a5, (Sig2 -> Sig2) -> Sig2 -> Sig2
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f Sig2
a6)
instance BindSig2  (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2) where  bindSig2 :: (Sig2 -> SE Sig2)
-> (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2)
-> SE (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2)
bindSig2 Sig2 -> SE Sig2
f (Sig2
a1, Sig2
a2, Sig2
a3, Sig2
a4, Sig2
a5, Sig2
a6) = (,,,,,) (Sig2
 -> Sig2
 -> Sig2
 -> Sig2
 -> Sig2
 -> Sig2
 -> (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2))
-> SE Sig2
-> SE
     (Sig2
      -> Sig2
      -> Sig2
      -> Sig2
      -> Sig2
      -> (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Sig2 -> SE Sig2) -> Sig2 -> SE Sig2
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f Sig2
a1 SE
  (Sig2
   -> Sig2
   -> Sig2
   -> Sig2
   -> Sig2
   -> (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2))
-> SE Sig2
-> SE
     (Sig2
      -> Sig2 -> Sig2 -> Sig2 -> (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2))
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig2 -> SE Sig2) -> Sig2 -> SE Sig2
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f Sig2
a2 SE
  (Sig2
   -> Sig2 -> Sig2 -> Sig2 -> (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2))
-> SE Sig2
-> SE
     (Sig2 -> Sig2 -> Sig2 -> (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2))
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig2 -> SE Sig2) -> Sig2 -> SE Sig2
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f Sig2
a3 SE (Sig2 -> Sig2 -> Sig2 -> (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2))
-> SE Sig2
-> SE (Sig2 -> Sig2 -> (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2))
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig2 -> SE Sig2) -> Sig2 -> SE Sig2
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f Sig2
a4 SE (Sig2 -> Sig2 -> (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2))
-> SE Sig2 -> SE (Sig2 -> (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2))
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig2 -> SE Sig2) -> Sig2 -> SE Sig2
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f Sig2
a5  SE (Sig2 -> (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2))
-> SE Sig2 -> SE (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2)
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig2 -> SE Sig2) -> Sig2 -> SE Sig2
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f Sig2
a6

instance SigSpace2 (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2) where  mapSig2 :: (Sig2 -> Sig2)
-> (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2)
-> (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2)
mapSig2  Sig2 -> Sig2
f (Sig2
a1, Sig2
a2, Sig2
a3, Sig2
a4, Sig2
a5, Sig2
a6, Sig2
a7) = ((Sig2 -> Sig2) -> Sig2 -> Sig2
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f Sig2
a1, (Sig2 -> Sig2) -> Sig2 -> Sig2
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f Sig2
a2, (Sig2 -> Sig2) -> Sig2 -> Sig2
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f Sig2
a3, (Sig2 -> Sig2) -> Sig2 -> Sig2
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f Sig2
a4, (Sig2 -> Sig2) -> Sig2 -> Sig2
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f Sig2
a5, (Sig2 -> Sig2) -> Sig2 -> Sig2
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f Sig2
a6, (Sig2 -> Sig2) -> Sig2 -> Sig2
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f Sig2
a7)
instance BindSig2  (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2) where  bindSig2 :: (Sig2 -> SE Sig2)
-> (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2)
-> SE (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2)
bindSig2 Sig2 -> SE Sig2
f (Sig2
a1, Sig2
a2, Sig2
a3, Sig2
a4, Sig2
a5, Sig2
a6, Sig2
a7) = (,,,,,,) (Sig2
 -> Sig2
 -> Sig2
 -> Sig2
 -> Sig2
 -> Sig2
 -> Sig2
 -> (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2))
-> SE Sig2
-> SE
     (Sig2
      -> Sig2
      -> Sig2
      -> Sig2
      -> Sig2
      -> Sig2
      -> (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Sig2 -> SE Sig2) -> Sig2 -> SE Sig2
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f Sig2
a1 SE
  (Sig2
   -> Sig2
   -> Sig2
   -> Sig2
   -> Sig2
   -> Sig2
   -> (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2))
-> SE Sig2
-> SE
     (Sig2
      -> Sig2
      -> Sig2
      -> Sig2
      -> Sig2
      -> (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2))
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig2 -> SE Sig2) -> Sig2 -> SE Sig2
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f Sig2
a2 SE
  (Sig2
   -> Sig2
   -> Sig2
   -> Sig2
   -> Sig2
   -> (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2))
-> SE Sig2
-> SE
     (Sig2
      -> Sig2
      -> Sig2
      -> Sig2
      -> (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2))
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig2 -> SE Sig2) -> Sig2 -> SE Sig2
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f Sig2
a3 SE
  (Sig2
   -> Sig2
   -> Sig2
   -> Sig2
   -> (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2))
-> SE Sig2
-> SE
     (Sig2
      -> Sig2 -> Sig2 -> (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2))
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig2 -> SE Sig2) -> Sig2 -> SE Sig2
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f Sig2
a4 SE
  (Sig2
   -> Sig2 -> Sig2 -> (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2))
-> SE Sig2
-> SE (Sig2 -> Sig2 -> (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2))
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig2 -> SE Sig2) -> Sig2 -> SE Sig2
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f Sig2
a5  SE (Sig2 -> Sig2 -> (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2))
-> SE Sig2
-> SE (Sig2 -> (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2))
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig2 -> SE Sig2) -> Sig2 -> SE Sig2
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f Sig2
a6 SE (Sig2 -> (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2))
-> SE Sig2 -> SE (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2)
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig2 -> SE Sig2) -> Sig2 -> SE Sig2
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f Sig2
a7

instance SigSpace2 (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2) where  mapSig2 :: (Sig2 -> Sig2)
-> (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2)
-> (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2)
mapSig2  Sig2 -> Sig2
f (Sig2
a1, Sig2
a2, Sig2
a3, Sig2
a4, Sig2
a5, Sig2
a6, Sig2
a7, Sig2
a8) = ((Sig2 -> Sig2) -> Sig2 -> Sig2
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f Sig2
a1, (Sig2 -> Sig2) -> Sig2 -> Sig2
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f Sig2
a2, (Sig2 -> Sig2) -> Sig2 -> Sig2
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f Sig2
a3, (Sig2 -> Sig2) -> Sig2 -> Sig2
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f Sig2
a4, (Sig2 -> Sig2) -> Sig2 -> Sig2
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f Sig2
a5, (Sig2 -> Sig2) -> Sig2 -> Sig2
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f Sig2
a6, (Sig2 -> Sig2) -> Sig2 -> Sig2
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f Sig2
a7, (Sig2 -> Sig2) -> Sig2 -> Sig2
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f Sig2
a8)
instance BindSig2  (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2) where  bindSig2 :: (Sig2 -> SE Sig2)
-> (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2)
-> SE (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2)
bindSig2 Sig2 -> SE Sig2
f (Sig2
a1, Sig2
a2, Sig2
a3, Sig2
a4, Sig2
a5, Sig2
a6, Sig2
a7, Sig2
a8) = (,,,,,,,) (Sig2
 -> Sig2
 -> Sig2
 -> Sig2
 -> Sig2
 -> Sig2
 -> Sig2
 -> Sig2
 -> (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2))
-> SE Sig2
-> SE
     (Sig2
      -> Sig2
      -> Sig2
      -> Sig2
      -> Sig2
      -> Sig2
      -> Sig2
      -> (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Sig2 -> SE Sig2) -> Sig2 -> SE Sig2
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f Sig2
a1 SE
  (Sig2
   -> Sig2
   -> Sig2
   -> Sig2
   -> Sig2
   -> Sig2
   -> Sig2
   -> (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2))
-> SE Sig2
-> SE
     (Sig2
      -> Sig2
      -> Sig2
      -> Sig2
      -> Sig2
      -> Sig2
      -> (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2))
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig2 -> SE Sig2) -> Sig2 -> SE Sig2
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f Sig2
a2 SE
  (Sig2
   -> Sig2
   -> Sig2
   -> Sig2
   -> Sig2
   -> Sig2
   -> (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2))
-> SE Sig2
-> SE
     (Sig2
      -> Sig2
      -> Sig2
      -> Sig2
      -> Sig2
      -> (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2))
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig2 -> SE Sig2) -> Sig2 -> SE Sig2
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f Sig2
a3 SE
  (Sig2
   -> Sig2
   -> Sig2
   -> Sig2
   -> Sig2
   -> (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2))
-> SE Sig2
-> SE
     (Sig2
      -> Sig2
      -> Sig2
      -> Sig2
      -> (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2))
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig2 -> SE Sig2) -> Sig2 -> SE Sig2
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f Sig2
a4 SE
  (Sig2
   -> Sig2
   -> Sig2
   -> Sig2
   -> (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2))
-> SE Sig2
-> SE
     (Sig2
      -> Sig2
      -> Sig2
      -> (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2))
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig2 -> SE Sig2) -> Sig2 -> SE Sig2
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f Sig2
a5  SE
  (Sig2
   -> Sig2
   -> Sig2
   -> (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2))
-> SE Sig2
-> SE
     (Sig2 -> Sig2 -> (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2))
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig2 -> SE Sig2) -> Sig2 -> SE Sig2
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f Sig2
a6 SE
  (Sig2 -> Sig2 -> (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2))
-> SE Sig2
-> SE (Sig2 -> (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2))
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig2 -> SE Sig2) -> Sig2 -> SE Sig2
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f Sig2
a7 SE (Sig2 -> (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2))
-> SE Sig2 -> SE (Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2, Sig2)
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig2 -> SE Sig2) -> Sig2 -> SE Sig2
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f Sig2
a8

instance SigSpace2 (Sig8, Sig8) where  mapSig2 :: (Sig2 -> Sig2)
-> ((Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig),
    (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig))
-> ((Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig),
    (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig))
mapSig2  Sig2 -> Sig2
f ((Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
a1, (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
a2) = ((Sig2 -> Sig2)
-> (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
-> (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
a1, (Sig2 -> Sig2)
-> (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
-> (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
a2)
instance BindSig2  (Sig8, Sig8) where  bindSig2 :: (Sig2 -> SE Sig2)
-> ((Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig),
    (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig))
-> SE
     ((Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig),
      (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig))
bindSig2 Sig2 -> SE Sig2
f ((Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
a1, (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
a2) = (,) ((Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
 -> (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
 -> ((Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig),
     (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)))
-> SE (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
-> SE
     ((Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
      -> ((Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig),
          (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Sig2 -> SE Sig2)
-> (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
-> SE (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
a1 SE
  ((Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
   -> ((Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig),
       (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)))
-> SE (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
-> SE
     ((Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig),
      (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig))
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig2 -> SE Sig2)
-> (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
-> SE (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
a2

instance SigSpace2 (Sig8, Sig8, Sig8, Sig8) where  mapSig2 :: (Sig2 -> Sig2)
-> ((Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig),
    (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig),
    (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig),
    (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig))
-> ((Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig),
    (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig),
    (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig),
    (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig))
mapSig2  Sig2 -> Sig2
f ((Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
a1, (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
a2, (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
a3, (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
a4) = ((Sig2 -> Sig2)
-> (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
-> (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
a1, (Sig2 -> Sig2)
-> (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
-> (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
a2, (Sig2 -> Sig2)
-> (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
-> (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
a3, (Sig2 -> Sig2)
-> (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
-> (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
a4)
instance BindSig2  (Sig8, Sig8, Sig8, Sig8) where  bindSig2 :: (Sig2 -> SE Sig2)
-> ((Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig),
    (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig),
    (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig),
    (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig))
-> SE
     ((Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig),
      (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig),
      (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig),
      (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig))
bindSig2 Sig2 -> SE Sig2
f ((Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
a1, (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
a2, (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
a3, (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
a4) = (,,,) ((Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
 -> (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
 -> (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
 -> (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
 -> ((Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig),
     (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig),
     (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig),
     (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)))
-> SE (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
-> SE
     ((Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
      -> (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
      -> (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
      -> ((Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig),
          (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig),
          (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig),
          (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Sig2 -> SE Sig2)
-> (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
-> SE (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
a1 SE
  ((Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
   -> (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
   -> (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
   -> ((Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig),
       (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig),
       (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig),
       (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)))
-> SE (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
-> SE
     ((Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
      -> (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
      -> ((Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig),
          (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig),
          (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig),
          (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)))
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig2 -> SE Sig2)
-> (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
-> SE (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
a2 SE
  ((Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
   -> (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
   -> ((Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig),
       (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig),
       (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig),
       (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)))
-> SE (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
-> SE
     ((Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
      -> ((Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig),
          (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig),
          (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig),
          (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)))
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig2 -> SE Sig2)
-> (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
-> SE (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
a3 SE
  ((Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
   -> ((Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig),
       (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig),
       (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig),
       (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)))
-> SE (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
-> SE
     ((Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig),
      (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig),
      (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig),
      (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig))
forall a b. SE (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Sig2 -> SE Sig2)
-> (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
-> SE (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
a4

instance SigSpace2 (SE Sig) where  mapSig2 :: (Sig2 -> Sig2) -> SE Sig -> SE Sig
mapSig2  Sig2 -> Sig2
f = (Sig -> Sig) -> SE Sig -> SE Sig
forall a b. (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((Sig2 -> Sig2) -> Sig -> Sig
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f)
instance BindSig2  (SE Sig) where  bindSig2 :: (Sig2 -> SE Sig2) -> SE Sig -> SE (SE Sig)
bindSig2 Sig2 -> SE Sig2
f = (Sig -> SE Sig) -> SE Sig -> SE (SE Sig)
forall a b. (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((Sig2 -> SE Sig2) -> Sig -> SE Sig
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f)

instance SigSpace2 (SE (Sig, Sig)) where mapSig2 :: (Sig2 -> Sig2) -> SE Sig2 -> SE Sig2
mapSig2  Sig2 -> Sig2
f = (Sig2 -> Sig2) -> SE Sig2 -> SE Sig2
forall a b. (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((Sig2 -> Sig2) -> Sig2 -> Sig2
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f)
instance BindSig2  (SE (Sig, Sig)) where bindSig2 :: (Sig2 -> SE Sig2) -> SE Sig2 -> SE (SE Sig2)
bindSig2 Sig2 -> SE Sig2
f = (Sig2 -> SE Sig2) -> SE Sig2 -> SE (SE Sig2)
forall a b. (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((Sig2 -> SE Sig2) -> Sig2 -> SE Sig2
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f)

instance SigSpace2 (SE (Sig, Sig, Sig)) where mapSig2 :: (Sig2 -> Sig2) -> SE (Sig, Sig, Sig) -> SE (Sig, Sig, Sig)
mapSig2  Sig2 -> Sig2
f = ((Sig, Sig, Sig) -> (Sig, Sig, Sig))
-> SE (Sig, Sig, Sig) -> SE (Sig, Sig, Sig)
forall a b. (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((Sig2 -> Sig2) -> (Sig, Sig, Sig) -> (Sig, Sig, Sig)
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f)
instance BindSig2  (SE (Sig, Sig, Sig)) where bindSig2 :: (Sig2 -> SE Sig2) -> SE (Sig, Sig, Sig) -> SE (SE (Sig, Sig, Sig))
bindSig2 Sig2 -> SE Sig2
f = ((Sig, Sig, Sig) -> SE (Sig, Sig, Sig))
-> SE (Sig, Sig, Sig) -> SE (SE (Sig, Sig, Sig))
forall a b. (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((Sig2 -> SE Sig2) -> (Sig, Sig, Sig) -> SE (Sig, Sig, Sig)
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f)

instance SigSpace2 (SE (Sig, Sig, Sig, Sig)) where mapSig2 :: (Sig2 -> Sig2)
-> SE (Sig, Sig, Sig, Sig) -> SE (Sig, Sig, Sig, Sig)
mapSig2  Sig2 -> Sig2
f = ((Sig, Sig, Sig, Sig) -> (Sig, Sig, Sig, Sig))
-> SE (Sig, Sig, Sig, Sig) -> SE (Sig, Sig, Sig, Sig)
forall a b. (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((Sig2 -> Sig2) -> (Sig, Sig, Sig, Sig) -> (Sig, Sig, Sig, Sig)
forall a. SigSpace2 a => (Sig2 -> Sig2) -> a -> a
mapSig2 Sig2 -> Sig2
f)
instance BindSig2  (SE (Sig, Sig, Sig, Sig)) where bindSig2 :: (Sig2 -> SE Sig2)
-> SE (Sig, Sig, Sig, Sig) -> SE (SE (Sig, Sig, Sig, Sig))
bindSig2 Sig2 -> SE Sig2
f = ((Sig, Sig, Sig, Sig) -> SE (Sig, Sig, Sig, Sig))
-> SE (Sig, Sig, Sig, Sig) -> SE (SE (Sig, Sig, Sig, Sig))
forall a b. (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((Sig2 -> SE Sig2)
-> (Sig, Sig, Sig, Sig) -> SE (Sig, Sig, Sig, Sig)
forall a. BindSig2 a => (Sig2 -> SE Sig2) -> a -> SE a
bindSig2 Sig2 -> SE Sig2
f)

----------------------------------------------------------------------------------------------------------
-- numeric instances

-- Num

instance Num (SE Sig) where
    + :: SE Sig -> SE Sig -> SE Sig
(+) = (Sig -> Sig -> Sig) -> SE Sig -> SE Sig -> SE Sig
forall a b c. (a -> b -> c) -> SE a -> SE b -> SE c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 Sig -> Sig -> Sig
forall a. Num a => a -> a -> a
(+)
    * :: SE Sig -> SE Sig -> SE Sig
(*) = (Sig -> Sig -> Sig) -> SE Sig -> SE Sig -> SE Sig
forall a b c. (a -> b -> c) -> SE a -> SE b -> SE c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 Sig -> Sig -> Sig
forall a. Num a => a -> a -> a
(*)
    negate :: SE Sig -> SE Sig
negate = (Sig -> Sig) -> SE Sig -> SE Sig
forall a b. (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Sig -> Sig
forall a. Num a => a -> a
negate

    fromInteger :: Integer -> SE Sig
fromInteger = Sig -> SE Sig
forall a. a -> SE a
forall (m :: * -> *) a. Monad m => a -> m a
return (Sig -> SE Sig) -> (Integer -> Sig) -> Integer -> SE Sig
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> Sig
forall a. Num a => Integer -> a
fromInteger
    signum :: SE Sig -> SE Sig
signum = (Sig -> Sig) -> SE Sig -> SE Sig
forall a b. (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Sig -> Sig
forall a. Num a => a -> a
signum
    abs :: SE Sig -> SE Sig
abs = (Sig -> Sig) -> SE Sig -> SE Sig
forall a b. (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Sig -> Sig
forall a. Num a => a -> a
abs

instance Num (SE (Sig, Sig)) where
    + :: SE Sig2 -> SE Sig2 -> SE Sig2
(+) = (Sig2 -> Sig2 -> Sig2) -> SE Sig2 -> SE Sig2 -> SE Sig2
forall a b c. (a -> b -> c) -> SE a -> SE b -> SE c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 Sig2 -> Sig2 -> Sig2
forall a. Num a => a -> a -> a
(+)
    * :: SE Sig2 -> SE Sig2 -> SE Sig2
(*) = (Sig2 -> Sig2 -> Sig2) -> SE Sig2 -> SE Sig2 -> SE Sig2
forall a b c. (a -> b -> c) -> SE a -> SE b -> SE c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 Sig2 -> Sig2 -> Sig2
forall a. Num a => a -> a -> a
(*)
    negate :: SE Sig2 -> SE Sig2
negate = (Sig2 -> Sig2) -> SE Sig2 -> SE Sig2
forall a b. (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Sig2 -> Sig2
forall a. Num a => a -> a
negate

    fromInteger :: Integer -> SE Sig2
fromInteger = Sig2 -> SE Sig2
forall a. a -> SE a
forall (m :: * -> *) a. Monad m => a -> m a
return (Sig2 -> SE Sig2) -> (Integer -> Sig2) -> Integer -> SE Sig2
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> Sig2
forall a. Num a => Integer -> a
fromInteger
    signum :: SE Sig2 -> SE Sig2
signum = (Sig2 -> Sig2) -> SE Sig2 -> SE Sig2
forall a b. (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Sig2 -> Sig2
forall a. Num a => a -> a
signum
    abs :: SE Sig2 -> SE Sig2
abs = (Sig2 -> Sig2) -> SE Sig2 -> SE Sig2
forall a b. (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Sig2 -> Sig2
forall a. Num a => a -> a
abs

instance Num (SE (Sig, Sig, Sig)) where
    + :: SE (Sig, Sig, Sig) -> SE (Sig, Sig, Sig) -> SE (Sig, Sig, Sig)
(+) = ((Sig, Sig, Sig) -> (Sig, Sig, Sig) -> (Sig, Sig, Sig))
-> SE (Sig, Sig, Sig) -> SE (Sig, Sig, Sig) -> SE (Sig, Sig, Sig)
forall a b c. (a -> b -> c) -> SE a -> SE b -> SE c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 (Sig, Sig, Sig) -> (Sig, Sig, Sig) -> (Sig, Sig, Sig)
forall a. Num a => a -> a -> a
(+)
    * :: SE (Sig, Sig, Sig) -> SE (Sig, Sig, Sig) -> SE (Sig, Sig, Sig)
(*) = ((Sig, Sig, Sig) -> (Sig, Sig, Sig) -> (Sig, Sig, Sig))
-> SE (Sig, Sig, Sig) -> SE (Sig, Sig, Sig) -> SE (Sig, Sig, Sig)
forall a b c. (a -> b -> c) -> SE a -> SE b -> SE c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 (Sig, Sig, Sig) -> (Sig, Sig, Sig) -> (Sig, Sig, Sig)
forall a. Num a => a -> a -> a
(*)
    negate :: SE (Sig, Sig, Sig) -> SE (Sig, Sig, Sig)
negate = ((Sig, Sig, Sig) -> (Sig, Sig, Sig))
-> SE (Sig, Sig, Sig) -> SE (Sig, Sig, Sig)
forall a b. (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Sig, Sig, Sig) -> (Sig, Sig, Sig)
forall a. Num a => a -> a
negate

    fromInteger :: Integer -> SE (Sig, Sig, Sig)
fromInteger = (Sig, Sig, Sig) -> SE (Sig, Sig, Sig)
forall a. a -> SE a
forall (m :: * -> *) a. Monad m => a -> m a
return ((Sig, Sig, Sig) -> SE (Sig, Sig, Sig))
-> (Integer -> (Sig, Sig, Sig)) -> Integer -> SE (Sig, Sig, Sig)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> (Sig, Sig, Sig)
forall a. Num a => Integer -> a
fromInteger
    signum :: SE (Sig, Sig, Sig) -> SE (Sig, Sig, Sig)
signum = ((Sig, Sig, Sig) -> (Sig, Sig, Sig))
-> SE (Sig, Sig, Sig) -> SE (Sig, Sig, Sig)
forall a b. (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Sig, Sig, Sig) -> (Sig, Sig, Sig)
forall a. Num a => a -> a
signum
    abs :: SE (Sig, Sig, Sig) -> SE (Sig, Sig, Sig)
abs = ((Sig, Sig, Sig) -> (Sig, Sig, Sig))
-> SE (Sig, Sig, Sig) -> SE (Sig, Sig, Sig)
forall a b. (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Sig, Sig, Sig) -> (Sig, Sig, Sig)
forall a. Num a => a -> a
abs

instance Num (SE (Sig, Sig, Sig, Sig)) where
    + :: SE (Sig, Sig, Sig, Sig)
-> SE (Sig, Sig, Sig, Sig) -> SE (Sig, Sig, Sig, Sig)
(+) = ((Sig, Sig, Sig, Sig)
 -> (Sig, Sig, Sig, Sig) -> (Sig, Sig, Sig, Sig))
-> SE (Sig, Sig, Sig, Sig)
-> SE (Sig, Sig, Sig, Sig)
-> SE (Sig, Sig, Sig, Sig)
forall a b c. (a -> b -> c) -> SE a -> SE b -> SE c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 (Sig, Sig, Sig, Sig)
-> (Sig, Sig, Sig, Sig) -> (Sig, Sig, Sig, Sig)
forall a. Num a => a -> a -> a
(+)
    * :: SE (Sig, Sig, Sig, Sig)
-> SE (Sig, Sig, Sig, Sig) -> SE (Sig, Sig, Sig, Sig)
(*) = ((Sig, Sig, Sig, Sig)
 -> (Sig, Sig, Sig, Sig) -> (Sig, Sig, Sig, Sig))
-> SE (Sig, Sig, Sig, Sig)
-> SE (Sig, Sig, Sig, Sig)
-> SE (Sig, Sig, Sig, Sig)
forall a b c. (a -> b -> c) -> SE a -> SE b -> SE c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 (Sig, Sig, Sig, Sig)
-> (Sig, Sig, Sig, Sig) -> (Sig, Sig, Sig, Sig)
forall a. Num a => a -> a -> a
(*)
    negate :: SE (Sig, Sig, Sig, Sig) -> SE (Sig, Sig, Sig, Sig)
negate = ((Sig, Sig, Sig, Sig) -> (Sig, Sig, Sig, Sig))
-> SE (Sig, Sig, Sig, Sig) -> SE (Sig, Sig, Sig, Sig)
forall a b. (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Sig, Sig, Sig, Sig) -> (Sig, Sig, Sig, Sig)
forall a. Num a => a -> a
negate

    fromInteger :: Integer -> SE (Sig, Sig, Sig, Sig)
fromInteger = (Sig, Sig, Sig, Sig) -> SE (Sig, Sig, Sig, Sig)
forall a. a -> SE a
forall (m :: * -> *) a. Monad m => a -> m a
return ((Sig, Sig, Sig, Sig) -> SE (Sig, Sig, Sig, Sig))
-> (Integer -> (Sig, Sig, Sig, Sig))
-> Integer
-> SE (Sig, Sig, Sig, Sig)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> (Sig, Sig, Sig, Sig)
forall a. Num a => Integer -> a
fromInteger
    signum :: SE (Sig, Sig, Sig, Sig) -> SE (Sig, Sig, Sig, Sig)
signum = ((Sig, Sig, Sig, Sig) -> (Sig, Sig, Sig, Sig))
-> SE (Sig, Sig, Sig, Sig) -> SE (Sig, Sig, Sig, Sig)
forall a b. (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Sig, Sig, Sig, Sig) -> (Sig, Sig, Sig, Sig)
forall a. Num a => a -> a
signum
    abs :: SE (Sig, Sig, Sig, Sig) -> SE (Sig, Sig, Sig, Sig)
abs = ((Sig, Sig, Sig, Sig) -> (Sig, Sig, Sig, Sig))
-> SE (Sig, Sig, Sig, Sig) -> SE (Sig, Sig, Sig, Sig)
forall a b. (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Sig, Sig, Sig, Sig) -> (Sig, Sig, Sig, Sig)
forall a. Num a => a -> a
abs

instance Num (a -> Sig) where
    + :: (a -> Sig) -> (a -> Sig) -> a -> Sig
(+) = (Sig -> Sig -> Sig) -> (a -> Sig) -> (a -> Sig) -> a -> Sig
forall a b c. (a -> b -> c) -> (a -> a) -> (a -> b) -> a -> c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 Sig -> Sig -> Sig
forall a. Num a => a -> a -> a
(+)
    * :: (a -> Sig) -> (a -> Sig) -> a -> Sig
(*) = (Sig -> Sig -> Sig) -> (a -> Sig) -> (a -> Sig) -> a -> Sig
forall a b c. (a -> b -> c) -> (a -> a) -> (a -> b) -> a -> c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 Sig -> Sig -> Sig
forall a. Num a => a -> a -> a
(*)
    negate :: (a -> Sig) -> a -> Sig
negate = (Sig -> Sig) -> (a -> Sig) -> a -> Sig
forall a b. (a -> b) -> (a -> a) -> a -> b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Sig -> Sig
forall a. Num a => a -> a
negate

    fromInteger :: Integer -> a -> Sig
fromInteger = Sig -> a -> Sig
forall a. a -> a -> a
forall (m :: * -> *) a. Monad m => a -> m a
return (Sig -> a -> Sig) -> (Integer -> Sig) -> Integer -> a -> Sig
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> Sig
forall a. Num a => Integer -> a
fromInteger
    signum :: (a -> Sig) -> a -> Sig
signum = (Sig -> Sig) -> (a -> Sig) -> a -> Sig
forall a b. (a -> b) -> (a -> a) -> a -> b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Sig -> Sig
forall a. Num a => a -> a
signum
    abs :: (a -> Sig) -> a -> Sig
abs = (Sig -> Sig) -> (a -> Sig) -> a -> Sig
forall a b. (a -> b) -> (a -> a) -> a -> b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Sig -> Sig
forall a. Num a => a -> a
abs

instance Num (a -> (Sig, Sig)) where
    + :: (a -> Sig2) -> (a -> Sig2) -> a -> Sig2
(+) = (Sig2 -> Sig2 -> Sig2) -> (a -> Sig2) -> (a -> Sig2) -> a -> Sig2
forall a b c. (a -> b -> c) -> (a -> a) -> (a -> b) -> a -> c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 Sig2 -> Sig2 -> Sig2
forall a. Num a => a -> a -> a
(+)
    * :: (a -> Sig2) -> (a -> Sig2) -> a -> Sig2
(*) = (Sig2 -> Sig2 -> Sig2) -> (a -> Sig2) -> (a -> Sig2) -> a -> Sig2
forall a b c. (a -> b -> c) -> (a -> a) -> (a -> b) -> a -> c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 Sig2 -> Sig2 -> Sig2
forall a. Num a => a -> a -> a
(*)
    negate :: (a -> Sig2) -> a -> Sig2
negate = (Sig2 -> Sig2) -> (a -> Sig2) -> a -> Sig2
forall a b. (a -> b) -> (a -> a) -> a -> b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Sig2 -> Sig2
forall a. Num a => a -> a
negate

    fromInteger :: Integer -> a -> Sig2
fromInteger = Sig2 -> a -> Sig2
forall a. a -> a -> a
forall (m :: * -> *) a. Monad m => a -> m a
return (Sig2 -> a -> Sig2) -> (Integer -> Sig2) -> Integer -> a -> Sig2
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> Sig2
forall a. Num a => Integer -> a
fromInteger
    signum :: (a -> Sig2) -> a -> Sig2
signum = (Sig2 -> Sig2) -> (a -> Sig2) -> a -> Sig2
forall a b. (a -> b) -> (a -> a) -> a -> b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Sig2 -> Sig2
forall a. Num a => a -> a
signum
    abs :: (a -> Sig2) -> a -> Sig2
abs = (Sig2 -> Sig2) -> (a -> Sig2) -> a -> Sig2
forall a b. (a -> b) -> (a -> a) -> a -> b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Sig2 -> Sig2
forall a. Num a => a -> a
abs

instance Num (a -> (Sig, Sig, Sig)) where
    + :: (a -> (Sig, Sig, Sig))
-> (a -> (Sig, Sig, Sig)) -> a -> (Sig, Sig, Sig)
(+) = ((Sig, Sig, Sig) -> (Sig, Sig, Sig) -> (Sig, Sig, Sig))
-> (a -> (Sig, Sig, Sig))
-> (a -> (Sig, Sig, Sig))
-> a
-> (Sig, Sig, Sig)
forall a b c. (a -> b -> c) -> (a -> a) -> (a -> b) -> a -> c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 (Sig, Sig, Sig) -> (Sig, Sig, Sig) -> (Sig, Sig, Sig)
forall a. Num a => a -> a -> a
(+)
    * :: (a -> (Sig, Sig, Sig))
-> (a -> (Sig, Sig, Sig)) -> a -> (Sig, Sig, Sig)
(*) = ((Sig, Sig, Sig) -> (Sig, Sig, Sig) -> (Sig, Sig, Sig))
-> (a -> (Sig, Sig, Sig))
-> (a -> (Sig, Sig, Sig))
-> a
-> (Sig, Sig, Sig)
forall a b c. (a -> b -> c) -> (a -> a) -> (a -> b) -> a -> c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 (Sig, Sig, Sig) -> (Sig, Sig, Sig) -> (Sig, Sig, Sig)
forall a. Num a => a -> a -> a
(*)
    negate :: (a -> (Sig, Sig, Sig)) -> a -> (Sig, Sig, Sig)
negate = ((Sig, Sig, Sig) -> (Sig, Sig, Sig))
-> (a -> (Sig, Sig, Sig)) -> a -> (Sig, Sig, Sig)
forall a b. (a -> b) -> (a -> a) -> a -> b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Sig, Sig, Sig) -> (Sig, Sig, Sig)
forall a. Num a => a -> a
negate

    fromInteger :: Integer -> a -> (Sig, Sig, Sig)
fromInteger = (Sig, Sig, Sig) -> a -> (Sig, Sig, Sig)
forall a. a -> a -> a
forall (m :: * -> *) a. Monad m => a -> m a
return ((Sig, Sig, Sig) -> a -> (Sig, Sig, Sig))
-> (Integer -> (Sig, Sig, Sig)) -> Integer -> a -> (Sig, Sig, Sig)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> (Sig, Sig, Sig)
forall a. Num a => Integer -> a
fromInteger
    signum :: (a -> (Sig, Sig, Sig)) -> a -> (Sig, Sig, Sig)
signum = ((Sig, Sig, Sig) -> (Sig, Sig, Sig))
-> (a -> (Sig, Sig, Sig)) -> a -> (Sig, Sig, Sig)
forall a b. (a -> b) -> (a -> a) -> a -> b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Sig, Sig, Sig) -> (Sig, Sig, Sig)
forall a. Num a => a -> a
signum
    abs :: (a -> (Sig, Sig, Sig)) -> a -> (Sig, Sig, Sig)
abs = ((Sig, Sig, Sig) -> (Sig, Sig, Sig))
-> (a -> (Sig, Sig, Sig)) -> a -> (Sig, Sig, Sig)
forall a b. (a -> b) -> (a -> a) -> a -> b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Sig, Sig, Sig) -> (Sig, Sig, Sig)
forall a. Num a => a -> a
abs

instance Num (a -> (Sig, Sig, Sig, Sig)) where
    + :: (a -> (Sig, Sig, Sig, Sig))
-> (a -> (Sig, Sig, Sig, Sig)) -> a -> (Sig, Sig, Sig, Sig)
(+) = ((Sig, Sig, Sig, Sig)
 -> (Sig, Sig, Sig, Sig) -> (Sig, Sig, Sig, Sig))
-> (a -> (Sig, Sig, Sig, Sig))
-> (a -> (Sig, Sig, Sig, Sig))
-> a
-> (Sig, Sig, Sig, Sig)
forall a b c. (a -> b -> c) -> (a -> a) -> (a -> b) -> a -> c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 (Sig, Sig, Sig, Sig)
-> (Sig, Sig, Sig, Sig) -> (Sig, Sig, Sig, Sig)
forall a. Num a => a -> a -> a
(+)
    * :: (a -> (Sig, Sig, Sig, Sig))
-> (a -> (Sig, Sig, Sig, Sig)) -> a -> (Sig, Sig, Sig, Sig)
(*) = ((Sig, Sig, Sig, Sig)
 -> (Sig, Sig, Sig, Sig) -> (Sig, Sig, Sig, Sig))
-> (a -> (Sig, Sig, Sig, Sig))
-> (a -> (Sig, Sig, Sig, Sig))
-> a
-> (Sig, Sig, Sig, Sig)
forall a b c. (a -> b -> c) -> (a -> a) -> (a -> b) -> a -> c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 (Sig, Sig, Sig, Sig)
-> (Sig, Sig, Sig, Sig) -> (Sig, Sig, Sig, Sig)
forall a. Num a => a -> a -> a
(*)
    negate :: (a -> (Sig, Sig, Sig, Sig)) -> a -> (Sig, Sig, Sig, Sig)
negate = ((Sig, Sig, Sig, Sig) -> (Sig, Sig, Sig, Sig))
-> (a -> (Sig, Sig, Sig, Sig)) -> a -> (Sig, Sig, Sig, Sig)
forall a b. (a -> b) -> (a -> a) -> a -> b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Sig, Sig, Sig, Sig) -> (Sig, Sig, Sig, Sig)
forall a. Num a => a -> a
negate

    fromInteger :: Integer -> a -> (Sig, Sig, Sig, Sig)
fromInteger = (Sig, Sig, Sig, Sig) -> a -> (Sig, Sig, Sig, Sig)
forall a. a -> a -> a
forall (m :: * -> *) a. Monad m => a -> m a
return ((Sig, Sig, Sig, Sig) -> a -> (Sig, Sig, Sig, Sig))
-> (Integer -> (Sig, Sig, Sig, Sig))
-> Integer
-> a
-> (Sig, Sig, Sig, Sig)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> (Sig, Sig, Sig, Sig)
forall a. Num a => Integer -> a
fromInteger
    signum :: (a -> (Sig, Sig, Sig, Sig)) -> a -> (Sig, Sig, Sig, Sig)
signum = ((Sig, Sig, Sig, Sig) -> (Sig, Sig, Sig, Sig))
-> (a -> (Sig, Sig, Sig, Sig)) -> a -> (Sig, Sig, Sig, Sig)
forall a b. (a -> b) -> (a -> a) -> a -> b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Sig, Sig, Sig, Sig) -> (Sig, Sig, Sig, Sig)
forall a. Num a => a -> a
signum
    abs :: (a -> (Sig, Sig, Sig, Sig)) -> a -> (Sig, Sig, Sig, Sig)
abs = ((Sig, Sig, Sig, Sig) -> (Sig, Sig, Sig, Sig))
-> (a -> (Sig, Sig, Sig, Sig)) -> a -> (Sig, Sig, Sig, Sig)
forall a b. (a -> b) -> (a -> a) -> a -> b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Sig, Sig, Sig, Sig) -> (Sig, Sig, Sig, Sig)
forall a. Num a => a -> a
abs


instance Num (a -> SE Sig) where
    + :: (a -> SE Sig) -> (a -> SE Sig) -> a -> SE Sig
(+) = (SE Sig -> SE Sig -> SE Sig)
-> (a -> SE Sig) -> (a -> SE Sig) -> a -> SE Sig
forall a b c. (a -> b -> c) -> (a -> a) -> (a -> b) -> a -> c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 SE Sig -> SE Sig -> SE Sig
forall a. Num a => a -> a -> a
(+)
    * :: (a -> SE Sig) -> (a -> SE Sig) -> a -> SE Sig
(*) = (SE Sig -> SE Sig -> SE Sig)
-> (a -> SE Sig) -> (a -> SE Sig) -> a -> SE Sig
forall a b c. (a -> b -> c) -> (a -> a) -> (a -> b) -> a -> c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 SE Sig -> SE Sig -> SE Sig
forall a. Num a => a -> a -> a
(*)
    negate :: (a -> SE Sig) -> a -> SE Sig
negate = (SE Sig -> SE Sig) -> (a -> SE Sig) -> a -> SE Sig
forall a b. (a -> b) -> (a -> a) -> a -> b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap SE Sig -> SE Sig
forall a. Num a => a -> a
negate

    fromInteger :: Integer -> a -> SE Sig
fromInteger = SE Sig -> a -> SE Sig
forall a. a -> a -> a
forall (m :: * -> *) a. Monad m => a -> m a
return (SE Sig -> a -> SE Sig)
-> (Integer -> SE Sig) -> Integer -> a -> SE Sig
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> SE Sig
forall a. Num a => Integer -> a
fromInteger
    signum :: (a -> SE Sig) -> a -> SE Sig
signum = (SE Sig -> SE Sig) -> (a -> SE Sig) -> a -> SE Sig
forall a b. (a -> b) -> (a -> a) -> a -> b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap SE Sig -> SE Sig
forall a. Num a => a -> a
signum
    abs :: (a -> SE Sig) -> a -> SE Sig
abs = (SE Sig -> SE Sig) -> (a -> SE Sig) -> a -> SE Sig
forall a b. (a -> b) -> (a -> a) -> a -> b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap SE Sig -> SE Sig
forall a. Num a => a -> a
abs

instance Num (a -> SE (Sig, Sig)) where
    + :: (a -> SE Sig2) -> (a -> SE Sig2) -> a -> SE Sig2
(+) = (SE Sig2 -> SE Sig2 -> SE Sig2)
-> (a -> SE Sig2) -> (a -> SE Sig2) -> a -> SE Sig2
forall a b c. (a -> b -> c) -> (a -> a) -> (a -> b) -> a -> c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 SE Sig2 -> SE Sig2 -> SE Sig2
forall a. Num a => a -> a -> a
(+)
    * :: (a -> SE Sig2) -> (a -> SE Sig2) -> a -> SE Sig2
(*) = (SE Sig2 -> SE Sig2 -> SE Sig2)
-> (a -> SE Sig2) -> (a -> SE Sig2) -> a -> SE Sig2
forall a b c. (a -> b -> c) -> (a -> a) -> (a -> b) -> a -> c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 SE Sig2 -> SE Sig2 -> SE Sig2
forall a. Num a => a -> a -> a
(*)
    negate :: (a -> SE Sig2) -> a -> SE Sig2
negate = (SE Sig2 -> SE Sig2) -> (a -> SE Sig2) -> a -> SE Sig2
forall a b. (a -> b) -> (a -> a) -> a -> b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap SE Sig2 -> SE Sig2
forall a. Num a => a -> a
negate

    fromInteger :: Integer -> a -> SE Sig2
fromInteger = SE Sig2 -> a -> SE Sig2
forall a. a -> a -> a
forall (m :: * -> *) a. Monad m => a -> m a
return (SE Sig2 -> a -> SE Sig2)
-> (Integer -> SE Sig2) -> Integer -> a -> SE Sig2
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> SE Sig2
forall a. Num a => Integer -> a
fromInteger
    signum :: (a -> SE Sig2) -> a -> SE Sig2
signum = (SE Sig2 -> SE Sig2) -> (a -> SE Sig2) -> a -> SE Sig2
forall a b. (a -> b) -> (a -> a) -> a -> b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap SE Sig2 -> SE Sig2
forall a. Num a => a -> a
signum
    abs :: (a -> SE Sig2) -> a -> SE Sig2
abs = (SE Sig2 -> SE Sig2) -> (a -> SE Sig2) -> a -> SE Sig2
forall a b. (a -> b) -> (a -> a) -> a -> b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap SE Sig2 -> SE Sig2
forall a. Num a => a -> a
abs

instance Num (a -> SE (Sig, Sig, Sig)) where
    + :: (a -> SE (Sig, Sig, Sig))
-> (a -> SE (Sig, Sig, Sig)) -> a -> SE (Sig, Sig, Sig)
(+) = (SE (Sig, Sig, Sig) -> SE (Sig, Sig, Sig) -> SE (Sig, Sig, Sig))
-> (a -> SE (Sig, Sig, Sig))
-> (a -> SE (Sig, Sig, Sig))
-> a
-> SE (Sig, Sig, Sig)
forall a b c. (a -> b -> c) -> (a -> a) -> (a -> b) -> a -> c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 SE (Sig, Sig, Sig) -> SE (Sig, Sig, Sig) -> SE (Sig, Sig, Sig)
forall a. Num a => a -> a -> a
(+)
    * :: (a -> SE (Sig, Sig, Sig))
-> (a -> SE (Sig, Sig, Sig)) -> a -> SE (Sig, Sig, Sig)
(*) = (SE (Sig, Sig, Sig) -> SE (Sig, Sig, Sig) -> SE (Sig, Sig, Sig))
-> (a -> SE (Sig, Sig, Sig))
-> (a -> SE (Sig, Sig, Sig))
-> a
-> SE (Sig, Sig, Sig)
forall a b c. (a -> b -> c) -> (a -> a) -> (a -> b) -> a -> c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 SE (Sig, Sig, Sig) -> SE (Sig, Sig, Sig) -> SE (Sig, Sig, Sig)
forall a. Num a => a -> a -> a
(*)
    negate :: (a -> SE (Sig, Sig, Sig)) -> a -> SE (Sig, Sig, Sig)
negate = (SE (Sig, Sig, Sig) -> SE (Sig, Sig, Sig))
-> (a -> SE (Sig, Sig, Sig)) -> a -> SE (Sig, Sig, Sig)
forall a b. (a -> b) -> (a -> a) -> a -> b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap SE (Sig, Sig, Sig) -> SE (Sig, Sig, Sig)
forall a. Num a => a -> a
negate

    fromInteger :: Integer -> a -> SE (Sig, Sig, Sig)
fromInteger = SE (Sig, Sig, Sig) -> a -> SE (Sig, Sig, Sig)
forall a. a -> a -> a
forall (m :: * -> *) a. Monad m => a -> m a
return (SE (Sig, Sig, Sig) -> a -> SE (Sig, Sig, Sig))
-> (Integer -> SE (Sig, Sig, Sig))
-> Integer
-> a
-> SE (Sig, Sig, Sig)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> SE (Sig, Sig, Sig)
forall a. Num a => Integer -> a
fromInteger
    signum :: (a -> SE (Sig, Sig, Sig)) -> a -> SE (Sig, Sig, Sig)
signum = (SE (Sig, Sig, Sig) -> SE (Sig, Sig, Sig))
-> (a -> SE (Sig, Sig, Sig)) -> a -> SE (Sig, Sig, Sig)
forall a b. (a -> b) -> (a -> a) -> a -> b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap SE (Sig, Sig, Sig) -> SE (Sig, Sig, Sig)
forall a. Num a => a -> a
signum
    abs :: (a -> SE (Sig, Sig, Sig)) -> a -> SE (Sig, Sig, Sig)
abs = (SE (Sig, Sig, Sig) -> SE (Sig, Sig, Sig))
-> (a -> SE (Sig, Sig, Sig)) -> a -> SE (Sig, Sig, Sig)
forall a b. (a -> b) -> (a -> a) -> a -> b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap SE (Sig, Sig, Sig) -> SE (Sig, Sig, Sig)
forall a. Num a => a -> a
abs

instance Num (a -> SE (Sig, Sig, Sig, Sig)) where
    + :: (a -> SE (Sig, Sig, Sig, Sig))
-> (a -> SE (Sig, Sig, Sig, Sig)) -> a -> SE (Sig, Sig, Sig, Sig)
(+) = (SE (Sig, Sig, Sig, Sig)
 -> SE (Sig, Sig, Sig, Sig) -> SE (Sig, Sig, Sig, Sig))
-> (a -> SE (Sig, Sig, Sig, Sig))
-> (a -> SE (Sig, Sig, Sig, Sig))
-> a
-> SE (Sig, Sig, Sig, Sig)
forall a b c. (a -> b -> c) -> (a -> a) -> (a -> b) -> a -> c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 SE (Sig, Sig, Sig, Sig)
-> SE (Sig, Sig, Sig, Sig) -> SE (Sig, Sig, Sig, Sig)
forall a. Num a => a -> a -> a
(+)
    * :: (a -> SE (Sig, Sig, Sig, Sig))
-> (a -> SE (Sig, Sig, Sig, Sig)) -> a -> SE (Sig, Sig, Sig, Sig)
(*) = (SE (Sig, Sig, Sig, Sig)
 -> SE (Sig, Sig, Sig, Sig) -> SE (Sig, Sig, Sig, Sig))
-> (a -> SE (Sig, Sig, Sig, Sig))
-> (a -> SE (Sig, Sig, Sig, Sig))
-> a
-> SE (Sig, Sig, Sig, Sig)
forall a b c. (a -> b -> c) -> (a -> a) -> (a -> b) -> a -> c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 SE (Sig, Sig, Sig, Sig)
-> SE (Sig, Sig, Sig, Sig) -> SE (Sig, Sig, Sig, Sig)
forall a. Num a => a -> a -> a
(*)
    negate :: (a -> SE (Sig, Sig, Sig, Sig)) -> a -> SE (Sig, Sig, Sig, Sig)
negate = (SE (Sig, Sig, Sig, Sig) -> SE (Sig, Sig, Sig, Sig))
-> (a -> SE (Sig, Sig, Sig, Sig)) -> a -> SE (Sig, Sig, Sig, Sig)
forall a b. (a -> b) -> (a -> a) -> a -> b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap SE (Sig, Sig, Sig, Sig) -> SE (Sig, Sig, Sig, Sig)
forall a. Num a => a -> a
negate

    fromInteger :: Integer -> a -> SE (Sig, Sig, Sig, Sig)
fromInteger = SE (Sig, Sig, Sig, Sig) -> a -> SE (Sig, Sig, Sig, Sig)
forall a. a -> a -> a
forall (m :: * -> *) a. Monad m => a -> m a
return (SE (Sig, Sig, Sig, Sig) -> a -> SE (Sig, Sig, Sig, Sig))
-> (Integer -> SE (Sig, Sig, Sig, Sig))
-> Integer
-> a
-> SE (Sig, Sig, Sig, Sig)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> SE (Sig, Sig, Sig, Sig)
forall a. Num a => Integer -> a
fromInteger
    signum :: (a -> SE (Sig, Sig, Sig, Sig)) -> a -> SE (Sig, Sig, Sig, Sig)
signum = (SE (Sig, Sig, Sig, Sig) -> SE (Sig, Sig, Sig, Sig))
-> (a -> SE (Sig, Sig, Sig, Sig)) -> a -> SE (Sig, Sig, Sig, Sig)
forall a b. (a -> b) -> (a -> a) -> a -> b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap SE (Sig, Sig, Sig, Sig) -> SE (Sig, Sig, Sig, Sig)
forall a. Num a => a -> a
signum
    abs :: (a -> SE (Sig, Sig, Sig, Sig)) -> a -> SE (Sig, Sig, Sig, Sig)
abs = (SE (Sig, Sig, Sig, Sig) -> SE (Sig, Sig, Sig, Sig))
-> (a -> SE (Sig, Sig, Sig, Sig)) -> a -> SE (Sig, Sig, Sig, Sig)
forall a b. (a -> b) -> (a -> a) -> a -> b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap SE (Sig, Sig, Sig, Sig) -> SE (Sig, Sig, Sig, Sig)
forall a. Num a => a -> a
abs

-- Fractional


instance Fractional (SE Sig) where
    / :: SE Sig -> SE Sig -> SE Sig
(/) = (Sig -> Sig -> Sig) -> SE Sig -> SE Sig -> SE Sig
forall a b c. (a -> b -> c) -> SE a -> SE b -> SE c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 Sig -> Sig -> Sig
forall a. Fractional a => a -> a -> a
(/)
    fromRational :: Rational -> SE Sig
fromRational = Sig -> SE Sig
forall a. a -> SE a
forall (m :: * -> *) a. Monad m => a -> m a
return (Sig -> SE Sig) -> (Rational -> Sig) -> Rational -> SE Sig
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Rational -> Sig
forall a. Fractional a => Rational -> a
fromRational

instance Fractional (SE (Sig, Sig)) where
    / :: SE Sig2 -> SE Sig2 -> SE Sig2
(/) = (Sig2 -> Sig2 -> Sig2) -> SE Sig2 -> SE Sig2 -> SE Sig2
forall a b c. (a -> b -> c) -> SE a -> SE b -> SE c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 Sig2 -> Sig2 -> Sig2
forall a. Fractional a => a -> a -> a
(/)
    fromRational :: Rational -> SE Sig2
fromRational = Sig2 -> SE Sig2
forall a. a -> SE a
forall (m :: * -> *) a. Monad m => a -> m a
return (Sig2 -> SE Sig2) -> (Rational -> Sig2) -> Rational -> SE Sig2
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Rational -> Sig2
forall a. Fractional a => Rational -> a
fromRational

instance Fractional (SE (Sig, Sig, Sig)) where
    / :: SE (Sig, Sig, Sig) -> SE (Sig, Sig, Sig) -> SE (Sig, Sig, Sig)
(/) = ((Sig, Sig, Sig) -> (Sig, Sig, Sig) -> (Sig, Sig, Sig))
-> SE (Sig, Sig, Sig) -> SE (Sig, Sig, Sig) -> SE (Sig, Sig, Sig)
forall a b c. (a -> b -> c) -> SE a -> SE b -> SE c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 (Sig, Sig, Sig) -> (Sig, Sig, Sig) -> (Sig, Sig, Sig)
forall a. Fractional a => a -> a -> a
(/)
    fromRational :: Rational -> SE (Sig, Sig, Sig)
fromRational = (Sig, Sig, Sig) -> SE (Sig, Sig, Sig)
forall a. a -> SE a
forall (m :: * -> *) a. Monad m => a -> m a
return ((Sig, Sig, Sig) -> SE (Sig, Sig, Sig))
-> (Rational -> (Sig, Sig, Sig)) -> Rational -> SE (Sig, Sig, Sig)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Rational -> (Sig, Sig, Sig)
forall a. Fractional a => Rational -> a
fromRational

instance Fractional (SE (Sig, Sig, Sig, Sig)) where
    / :: SE (Sig, Sig, Sig, Sig)
-> SE (Sig, Sig, Sig, Sig) -> SE (Sig, Sig, Sig, Sig)
(/) = ((Sig, Sig, Sig, Sig)
 -> (Sig, Sig, Sig, Sig) -> (Sig, Sig, Sig, Sig))
-> SE (Sig, Sig, Sig, Sig)
-> SE (Sig, Sig, Sig, Sig)
-> SE (Sig, Sig, Sig, Sig)
forall a b c. (a -> b -> c) -> SE a -> SE b -> SE c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 (Sig, Sig, Sig, Sig)
-> (Sig, Sig, Sig, Sig) -> (Sig, Sig, Sig, Sig)
forall a. Fractional a => a -> a -> a
(/)
    fromRational :: Rational -> SE (Sig, Sig, Sig, Sig)
fromRational = (Sig, Sig, Sig, Sig) -> SE (Sig, Sig, Sig, Sig)
forall a. a -> SE a
forall (m :: * -> *) a. Monad m => a -> m a
return ((Sig, Sig, Sig, Sig) -> SE (Sig, Sig, Sig, Sig))
-> (Rational -> (Sig, Sig, Sig, Sig))
-> Rational
-> SE (Sig, Sig, Sig, Sig)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Rational -> (Sig, Sig, Sig, Sig)
forall a. Fractional a => Rational -> a
fromRational

instance Fractional (a -> SE Sig) where
    / :: (a -> SE Sig) -> (a -> SE Sig) -> a -> SE Sig
(/) = (SE Sig -> SE Sig -> SE Sig)
-> (a -> SE Sig) -> (a -> SE Sig) -> a -> SE Sig
forall a b c. (a -> b -> c) -> (a -> a) -> (a -> b) -> a -> c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 SE Sig -> SE Sig -> SE Sig
forall a. Fractional a => a -> a -> a
(/)
    fromRational :: Rational -> a -> SE Sig
fromRational = SE Sig -> a -> SE Sig
forall a. a -> a -> a
forall (m :: * -> *) a. Monad m => a -> m a
return (SE Sig -> a -> SE Sig)
-> (Rational -> SE Sig) -> Rational -> a -> SE Sig
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Rational -> SE Sig
forall a. Fractional a => Rational -> a
fromRational

instance Fractional (a -> SE (Sig, Sig)) where
    / :: (a -> SE Sig2) -> (a -> SE Sig2) -> a -> SE Sig2
(/) = (SE Sig2 -> SE Sig2 -> SE Sig2)
-> (a -> SE Sig2) -> (a -> SE Sig2) -> a -> SE Sig2
forall a b c. (a -> b -> c) -> (a -> a) -> (a -> b) -> a -> c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 SE Sig2 -> SE Sig2 -> SE Sig2
forall a. Fractional a => a -> a -> a
(/)
    fromRational :: Rational -> a -> SE Sig2
fromRational = SE Sig2 -> a -> SE Sig2
forall a. a -> a -> a
forall (m :: * -> *) a. Monad m => a -> m a
return (SE Sig2 -> a -> SE Sig2)
-> (Rational -> SE Sig2) -> Rational -> a -> SE Sig2
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Rational -> SE Sig2
forall a. Fractional a => Rational -> a
fromRational

instance Fractional (a -> SE (Sig, Sig, Sig)) where
    / :: (a -> SE (Sig, Sig, Sig))
-> (a -> SE (Sig, Sig, Sig)) -> a -> SE (Sig, Sig, Sig)
(/) = (SE (Sig, Sig, Sig) -> SE (Sig, Sig, Sig) -> SE (Sig, Sig, Sig))
-> (a -> SE (Sig, Sig, Sig))
-> (a -> SE (Sig, Sig, Sig))
-> a
-> SE (Sig, Sig, Sig)
forall a b c. (a -> b -> c) -> (a -> a) -> (a -> b) -> a -> c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 SE (Sig, Sig, Sig) -> SE (Sig, Sig, Sig) -> SE (Sig, Sig, Sig)
forall a. Fractional a => a -> a -> a
(/)
    fromRational :: Rational -> a -> SE (Sig, Sig, Sig)
fromRational = SE (Sig, Sig, Sig) -> a -> SE (Sig, Sig, Sig)
forall a. a -> a -> a
forall (m :: * -> *) a. Monad m => a -> m a
return (SE (Sig, Sig, Sig) -> a -> SE (Sig, Sig, Sig))
-> (Rational -> SE (Sig, Sig, Sig))
-> Rational
-> a
-> SE (Sig, Sig, Sig)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Rational -> SE (Sig, Sig, Sig)
forall a. Fractional a => Rational -> a
fromRational

instance Fractional (a -> SE (Sig, Sig, Sig, Sig)) where
    / :: (a -> SE (Sig, Sig, Sig, Sig))
-> (a -> SE (Sig, Sig, Sig, Sig)) -> a -> SE (Sig, Sig, Sig, Sig)
(/) = (SE (Sig, Sig, Sig, Sig)
 -> SE (Sig, Sig, Sig, Sig) -> SE (Sig, Sig, Sig, Sig))
-> (a -> SE (Sig, Sig, Sig, Sig))
-> (a -> SE (Sig, Sig, Sig, Sig))
-> a
-> SE (Sig, Sig, Sig, Sig)
forall a b c. (a -> b -> c) -> (a -> a) -> (a -> b) -> a -> c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 SE (Sig, Sig, Sig, Sig)
-> SE (Sig, Sig, Sig, Sig) -> SE (Sig, Sig, Sig, Sig)
forall a. Fractional a => a -> a -> a
(/)
    fromRational :: Rational -> a -> SE (Sig, Sig, Sig, Sig)
fromRational = SE (Sig, Sig, Sig, Sig) -> a -> SE (Sig, Sig, Sig, Sig)
forall a. a -> a -> a
forall (m :: * -> *) a. Monad m => a -> m a
return (SE (Sig, Sig, Sig, Sig) -> a -> SE (Sig, Sig, Sig, Sig))
-> (Rational -> SE (Sig, Sig, Sig, Sig))
-> Rational
-> a
-> SE (Sig, Sig, Sig, Sig)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Rational -> SE (Sig, Sig, Sig, Sig)
forall a. Fractional a => Rational -> a
fromRational

instance Fractional (a -> Sig) where
    / :: (a -> Sig) -> (a -> Sig) -> a -> Sig
(/) = (Sig -> Sig -> Sig) -> (a -> Sig) -> (a -> Sig) -> a -> Sig
forall a b c. (a -> b -> c) -> (a -> a) -> (a -> b) -> a -> c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 Sig -> Sig -> Sig
forall a. Fractional a => a -> a -> a
(/)
    fromRational :: Rational -> a -> Sig
fromRational = Sig -> a -> Sig
forall a. a -> a -> a
forall (m :: * -> *) a. Monad m => a -> m a
return (Sig -> a -> Sig) -> (Rational -> Sig) -> Rational -> a -> Sig
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Rational -> Sig
forall a. Fractional a => Rational -> a
fromRational

instance Fractional (a -> (Sig, Sig)) where
    / :: (a -> Sig2) -> (a -> Sig2) -> a -> Sig2
(/) = (Sig2 -> Sig2 -> Sig2) -> (a -> Sig2) -> (a -> Sig2) -> a -> Sig2
forall a b c. (a -> b -> c) -> (a -> a) -> (a -> b) -> a -> c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 Sig2 -> Sig2 -> Sig2
forall a. Fractional a => a -> a -> a
(/)
    fromRational :: Rational -> a -> Sig2
fromRational = Sig2 -> a -> Sig2
forall a. a -> a -> a
forall (m :: * -> *) a. Monad m => a -> m a
return (Sig2 -> a -> Sig2) -> (Rational -> Sig2) -> Rational -> a -> Sig2
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Rational -> Sig2
forall a. Fractional a => Rational -> a
fromRational

instance Fractional (a -> (Sig, Sig, Sig)) where
    / :: (a -> (Sig, Sig, Sig))
-> (a -> (Sig, Sig, Sig)) -> a -> (Sig, Sig, Sig)
(/) = ((Sig, Sig, Sig) -> (Sig, Sig, Sig) -> (Sig, Sig, Sig))
-> (a -> (Sig, Sig, Sig))
-> (a -> (Sig, Sig, Sig))
-> a
-> (Sig, Sig, Sig)
forall a b c. (a -> b -> c) -> (a -> a) -> (a -> b) -> a -> c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 (Sig, Sig, Sig) -> (Sig, Sig, Sig) -> (Sig, Sig, Sig)
forall a. Fractional a => a -> a -> a
(/)
    fromRational :: Rational -> a -> (Sig, Sig, Sig)
fromRational = (Sig, Sig, Sig) -> a -> (Sig, Sig, Sig)
forall a. a -> a -> a
forall (m :: * -> *) a. Monad m => a -> m a
return ((Sig, Sig, Sig) -> a -> (Sig, Sig, Sig))
-> (Rational -> (Sig, Sig, Sig))
-> Rational
-> a
-> (Sig, Sig, Sig)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Rational -> (Sig, Sig, Sig)
forall a. Fractional a => Rational -> a
fromRational

instance Fractional (a -> (Sig, Sig, Sig, Sig)) where
    / :: (a -> (Sig, Sig, Sig, Sig))
-> (a -> (Sig, Sig, Sig, Sig)) -> a -> (Sig, Sig, Sig, Sig)
(/) = ((Sig, Sig, Sig, Sig)
 -> (Sig, Sig, Sig, Sig) -> (Sig, Sig, Sig, Sig))
-> (a -> (Sig, Sig, Sig, Sig))
-> (a -> (Sig, Sig, Sig, Sig))
-> a
-> (Sig, Sig, Sig, Sig)
forall a b c. (a -> b -> c) -> (a -> a) -> (a -> b) -> a -> c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 (Sig, Sig, Sig, Sig)
-> (Sig, Sig, Sig, Sig) -> (Sig, Sig, Sig, Sig)
forall a. Fractional a => a -> a -> a
(/)
    fromRational :: Rational -> a -> (Sig, Sig, Sig, Sig)
fromRational = (Sig, Sig, Sig, Sig) -> a -> (Sig, Sig, Sig, Sig)
forall a. a -> a -> a
forall (m :: * -> *) a. Monad m => a -> m a
return ((Sig, Sig, Sig, Sig) -> a -> (Sig, Sig, Sig, Sig))
-> (Rational -> (Sig, Sig, Sig, Sig))
-> Rational
-> a
-> (Sig, Sig, Sig, Sig)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Rational -> (Sig, Sig, Sig, Sig)
forall a. Fractional a => Rational -> a
fromRational

-----------------------------------------------------------------------
-----------------------------------------------------------------------

class SigSpace b => At a b c where
    type AtOut a b c :: Type
    at :: (a -> b) -> c -> AtOut a b c

instance SigSpace a => At Sig Sig a where
    type AtOut Sig Sig a = a
    at :: (Sig -> Sig) -> a -> AtOut Sig Sig a
at Sig -> Sig
f a
a = (Sig -> Sig) -> a -> a
forall a. SigSpace a => (Sig -> Sig) -> a -> a
mapSig Sig -> Sig
f a
a

------------------------------------------------------
-- for (Sig -> SE Sig)

instance At Sig (SE Sig) Sig where
    type AtOut Sig (SE Sig) Sig = SE Sig
    at :: (Sig -> SE Sig) -> Sig -> AtOut Sig (SE Sig) Sig
at Sig -> SE Sig
f Sig
a = Sig -> SE Sig
f Sig
a

instance At Sig (SE Sig) Sig2 where
    type AtOut Sig (SE Sig) Sig2 = SE Sig2
    at :: (Sig -> SE Sig) -> Sig2 -> AtOut Sig (SE Sig) Sig2
at Sig -> SE Sig
f Sig2
a = (Sig -> SE Sig) -> Sig2 -> SE Sig2
forall a. BindSig a => (Sig -> SE Sig) -> a -> SE a
bindSig Sig -> SE Sig
f Sig2
a

instance At Sig (SE Sig) Sig3 where
    type AtOut Sig (SE Sig) Sig3 = SE Sig3
    at :: (Sig -> SE Sig)
-> (Sig, Sig, Sig) -> AtOut Sig (SE Sig) (Sig, Sig, Sig)
at Sig -> SE Sig
f (Sig, Sig, Sig)
a = (Sig -> SE Sig) -> (Sig, Sig, Sig) -> SE (Sig, Sig, Sig)
forall a. BindSig a => (Sig -> SE Sig) -> a -> SE a
bindSig Sig -> SE Sig
f (Sig, Sig, Sig)
a

instance At Sig (SE Sig) Sig4 where
    type AtOut Sig (SE Sig) Sig4 = SE Sig4
    at :: (Sig -> SE Sig)
-> (Sig, Sig, Sig, Sig) -> AtOut Sig (SE Sig) (Sig, Sig, Sig, Sig)
at Sig -> SE Sig
f (Sig, Sig, Sig, Sig)
a = (Sig -> SE Sig) -> (Sig, Sig, Sig, Sig) -> SE (Sig, Sig, Sig, Sig)
forall a. BindSig a => (Sig -> SE Sig) -> a -> SE a
bindSig Sig -> SE Sig
f (Sig, Sig, Sig, Sig)
a

instance At Sig (SE Sig) (SE Sig) where
    type AtOut Sig (SE Sig) (SE Sig) = SE Sig
    at :: (Sig -> SE Sig) -> SE Sig -> AtOut Sig (SE Sig) (SE Sig)
at Sig -> SE Sig
f SE Sig
a = SE (SE Sig) -> SE Sig
forall (m :: * -> *) a. Monad m => m (m a) -> m a
join (SE (SE Sig) -> SE Sig) -> SE (SE Sig) -> SE Sig
forall a b. (a -> b) -> a -> b
$ (Sig -> SE Sig) -> SE Sig -> SE (SE Sig)
forall a. BindSig a => (Sig -> SE Sig) -> a -> SE a
bindSig Sig -> SE Sig
f SE Sig
a

instance At Sig (SE Sig) (SE Sig2) where
    type AtOut Sig (SE Sig) (SE Sig2) = SE Sig2
    at :: (Sig -> SE Sig) -> SE Sig2 -> AtOut Sig (SE Sig) (SE Sig2)
at Sig -> SE Sig
f SE Sig2
a = SE (SE Sig2) -> SE Sig2
forall (m :: * -> *) a. Monad m => m (m a) -> m a
join (SE (SE Sig2) -> SE Sig2) -> SE (SE Sig2) -> SE Sig2
forall a b. (a -> b) -> a -> b
$ (Sig -> SE Sig) -> SE Sig2 -> SE (SE Sig2)
forall a. BindSig a => (Sig -> SE Sig) -> a -> SE a
bindSig Sig -> SE Sig
f SE Sig2
a

instance At Sig (SE Sig) (SE Sig3) where
    type AtOut Sig (SE Sig) (SE Sig3) = SE Sig3
    at :: (Sig -> SE Sig)
-> SE (Sig, Sig, Sig) -> AtOut Sig (SE Sig) (SE (Sig, Sig, Sig))
at Sig -> SE Sig
f SE (Sig, Sig, Sig)
a = SE (SE (Sig, Sig, Sig)) -> SE (Sig, Sig, Sig)
forall (m :: * -> *) a. Monad m => m (m a) -> m a
join (SE (SE (Sig, Sig, Sig)) -> SE (Sig, Sig, Sig))
-> SE (SE (Sig, Sig, Sig)) -> SE (Sig, Sig, Sig)
forall a b. (a -> b) -> a -> b
$ (Sig -> SE Sig) -> SE (Sig, Sig, Sig) -> SE (SE (Sig, Sig, Sig))
forall a. BindSig a => (Sig -> SE Sig) -> a -> SE a
bindSig Sig -> SE Sig
f SE (Sig, Sig, Sig)
a

instance At Sig (SE Sig) (SE Sig4) where
    type AtOut Sig (SE Sig) (SE Sig4) = SE Sig4
    at :: (Sig -> SE Sig)
-> SE (Sig, Sig, Sig, Sig)
-> AtOut Sig (SE Sig) (SE (Sig, Sig, Sig, Sig))
at Sig -> SE Sig
f SE (Sig, Sig, Sig, Sig)
a = SE (SE (Sig, Sig, Sig, Sig)) -> SE (Sig, Sig, Sig, Sig)
forall (m :: * -> *) a. Monad m => m (m a) -> m a
join (SE (SE (Sig, Sig, Sig, Sig)) -> SE (Sig, Sig, Sig, Sig))
-> SE (SE (Sig, Sig, Sig, Sig)) -> SE (Sig, Sig, Sig, Sig)
forall a b. (a -> b) -> a -> b
$ (Sig -> SE Sig)
-> SE (Sig, Sig, Sig, Sig) -> SE (SE (Sig, Sig, Sig, Sig))
forall a. BindSig a => (Sig -> SE Sig) -> a -> SE a
bindSig Sig -> SE Sig
f SE (Sig, Sig, Sig, Sig)
a

-----------------------------------------------------
-- mono to stereo

instance At Sig Sig2 Sig where
    type AtOut Sig Sig2 Sig = Sig2
    at :: (Sig -> Sig2) -> Sig -> AtOut Sig Sig2 Sig
at Sig -> Sig2
f Sig
a = Sig -> Sig2
f Sig
a

instance At Sig Sig2 (SE Sig) where
    type AtOut Sig Sig2 (SE Sig) = SE Sig2
    at :: (Sig -> Sig2) -> SE Sig -> AtOut Sig Sig2 (SE Sig)
at Sig -> Sig2
f SE Sig
a = (Sig -> Sig2) -> SE Sig -> SE Sig2
forall a b. (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Sig -> Sig2
f SE Sig
a

instance At Sig Sig2 Sig2 where
    type AtOut Sig Sig2 Sig2 = Sig2
    at :: (Sig -> Sig2) -> Sig2 -> AtOut Sig Sig2 Sig2
at Sig -> Sig2
f Sig2
a = Sig2
0.5 Sig2 -> Sig2 -> Sig2
forall a. Num a => a -> a -> a
* (Sig -> Sig2
f (Sig2 -> Sig
forall a b. (a, b) -> a
fst Sig2
a) Sig2 -> Sig2 -> Sig2
forall a. Num a => a -> a -> a
+ Sig -> Sig2
f (Sig2 -> Sig
forall a b. (a, b) -> b
snd Sig2
a))

instance At Sig Sig2 (SE Sig2) where
    type AtOut Sig Sig2 (SE Sig2) = SE Sig2
    at :: (Sig -> Sig2) -> SE Sig2 -> AtOut Sig Sig2 (SE Sig2)
at Sig -> Sig2
f SE Sig2
a = (Sig2 -> Sig2) -> SE Sig2 -> SE Sig2
forall a b. (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((Sig -> Sig2) -> Sig2 -> AtOut Sig Sig2 Sig2
forall a b c. At a b c => (a -> b) -> c -> AtOut a b c
at Sig -> Sig2
f) SE Sig2
a

---------------------------------------------------------

---------------------------------------------------------
-- Sig2 -> Sig2

fromMono :: Sig -> Sig2
fromMono :: Sig -> Sig2
fromMono Sig
a = (Sig
a, Sig
a)

instance At Sig2 Sig2 Sig where
    type AtOut Sig2 Sig2 Sig = Sig2
    at :: (Sig2 -> Sig2) -> Sig -> AtOut Sig2 Sig2 Sig
at Sig2 -> Sig2
f Sig
a = Sig2 -> Sig2
f (Sig2 -> Sig2) -> Sig2 -> Sig2
forall a b. (a -> b) -> a -> b
$ Sig -> Sig2
fromMono Sig
a

instance At Sig2 Sig2 Sig2 where
    type AtOut Sig2 Sig2 Sig2 = Sig2
    at :: (Sig2 -> Sig2) -> Sig2 -> AtOut Sig2 Sig2 Sig2
at Sig2 -> Sig2
f Sig2
a = Sig2 -> Sig2
f Sig2
a

instance At Sig2 Sig2 (SE Sig) where
    type AtOut Sig2 Sig2 (SE Sig) = SE Sig2
    at :: (Sig2 -> Sig2) -> SE Sig -> AtOut Sig2 Sig2 (SE Sig)
at Sig2 -> Sig2
f SE Sig
a = (Sig -> Sig2) -> SE Sig -> SE Sig2
forall a b. (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Sig2 -> Sig2
f (Sig2 -> Sig2) -> (Sig -> Sig2) -> Sig -> Sig2
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Sig -> Sig2
fromMono) SE Sig
a

instance At Sig2 Sig2 (SE Sig2) where
    type AtOut Sig2 Sig2 (SE Sig2) = SE Sig2
    at :: (Sig2 -> Sig2) -> SE Sig2 -> AtOut Sig2 Sig2 (SE Sig2)
at Sig2 -> Sig2
f SE Sig2
a = (Sig2 -> Sig2) -> SE Sig2 -> SE Sig2
forall a b. (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Sig2 -> Sig2
f SE Sig2
a

---------------------------------------------
-- Sig2 -> SE Sig2

instance At Sig2 (SE Sig2) Sig where
    type AtOut Sig2 (SE Sig2) Sig = SE Sig2
    at :: (Sig2 -> SE Sig2) -> Sig -> AtOut Sig2 (SE Sig2) Sig
at Sig2 -> SE Sig2
f Sig
a = Sig2 -> SE Sig2
f (Sig2 -> SE Sig2) -> Sig2 -> SE Sig2
forall a b. (a -> b) -> a -> b
$ Sig -> Sig2
fromMono Sig
a

instance At Sig2 (SE Sig2) Sig2 where
    type AtOut Sig2 (SE Sig2) Sig2 = SE Sig2
    at :: (Sig2 -> SE Sig2) -> Sig2 -> AtOut Sig2 (SE Sig2) Sig2
at Sig2 -> SE Sig2
f Sig2
a = Sig2 -> SE Sig2
f Sig2
a

instance At Sig2 (SE Sig2) (SE Sig) where
    type AtOut Sig2 (SE Sig2) (SE Sig) = SE Sig2
    at :: (Sig2 -> SE Sig2) -> SE Sig -> AtOut Sig2 (SE Sig2) (SE Sig)
at Sig2 -> SE Sig2
f SE Sig
a = (Sig2 -> SE Sig2
f (Sig2 -> SE Sig2) -> (Sig -> Sig2) -> Sig -> SE Sig2
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Sig -> Sig2
fromMono) (Sig -> SE Sig2) -> SE Sig -> SE Sig2
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< SE Sig
a

instance At Sig2 (SE Sig2) (SE Sig2) where
    type AtOut Sig2 (SE Sig2) (SE Sig2) = SE Sig2
    at :: (Sig2 -> SE Sig2) -> SE Sig2 -> AtOut Sig2 (SE Sig2) (SE Sig2)
at Sig2 -> SE Sig2
f SE Sig2
a = Sig2 -> SE Sig2
f (Sig2 -> SE Sig2) -> SE Sig2 -> SE Sig2
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< SE Sig2
a

-----------------------------------------------------------------------
-----------------------------------------------------------------------
-- MixAt

-- | It applies an effect and mixes the processed signal with original one.
-- The first argument is for proportion of dry/wet (original/processed).
-- It's like @at@ but it allows to balance processed signal with original one.
class (SigSpace b, At a b c) => MixAt a b c where
    mixAt :: Sig -> (a -> b) -> c -> AtOut a b c

---------------------------------------------------

instance SigSpace a => MixAt Sig Sig a where
    mixAt :: Sig -> (Sig -> Sig) -> a -> AtOut Sig Sig a
mixAt Sig
k Sig -> Sig
f a
a = (Sig -> Sig) -> a -> a
forall a. SigSpace a => (Sig -> Sig) -> a -> a
mapSig (\Sig
x -> Sig -> Sig -> Sig -> Sig
forall a. (Num a, SigSpace a) => Sig -> a -> a -> a
cfd Sig
k Sig
x (Sig -> Sig
f Sig
x)) a
a

------------------------------------------------------
-- for (Sig -> SE Sig)

instance MixAt Sig (SE Sig) Sig where
    mixAt :: Sig -> (Sig -> SE Sig) -> Sig -> AtOut Sig (SE Sig) Sig
mixAt Sig
k Sig -> SE Sig
f Sig
dry = do
        Sig
wet <- Sig -> SE Sig
f Sig
dry
        Sig -> SE Sig
forall a. a -> SE a
forall (m :: * -> *) a. Monad m => a -> m a
return (Sig -> SE Sig) -> Sig -> SE Sig
forall a b. (a -> b) -> a -> b
$ Sig -> Sig -> Sig -> Sig
forall a. (Num a, SigSpace a) => Sig -> a -> a -> a
cfd Sig
k Sig
dry Sig
wet

instance MixAt Sig (SE Sig) Sig2 where
    mixAt :: Sig -> (Sig -> SE Sig) -> Sig2 -> AtOut Sig (SE Sig) Sig2
mixAt Sig
k Sig -> SE Sig
f (Sig
dry1, Sig
dry2) = do
        Sig
wet1 <- Sig -> SE Sig
f Sig
dry1
        Sig
wet2 <- Sig -> SE Sig
f Sig
dry2
        Sig2 -> SE Sig2
forall a. a -> SE a
forall (m :: * -> *) a. Monad m => a -> m a
return (Sig2 -> SE Sig2) -> Sig2 -> SE Sig2
forall a b. (a -> b) -> a -> b
$ Sig -> Sig2 -> Sig2 -> Sig2
forall a. (Num a, SigSpace a) => Sig -> a -> a -> a
cfd Sig
k (Sig
dry1, Sig
dry2) (Sig
wet1, Sig
wet2)

instance MixAt Sig (SE Sig) Sig3 where
    mixAt :: Sig
-> (Sig -> SE Sig)
-> (Sig, Sig, Sig)
-> AtOut Sig (SE Sig) (Sig, Sig, Sig)
mixAt Sig
k Sig -> SE Sig
f (Sig
dry1, Sig
dry2, Sig
dry3) = do
        Sig
wet1 <- Sig -> SE Sig
f Sig
dry1
        Sig
wet2 <- Sig -> SE Sig
f Sig
dry2
        Sig
wet3 <- Sig -> SE Sig
f Sig
dry3
        (Sig, Sig, Sig) -> SE (Sig, Sig, Sig)
forall a. a -> SE a
forall (m :: * -> *) a. Monad m => a -> m a
return ((Sig, Sig, Sig) -> SE (Sig, Sig, Sig))
-> (Sig, Sig, Sig) -> SE (Sig, Sig, Sig)
forall a b. (a -> b) -> a -> b
$ Sig -> (Sig, Sig, Sig) -> (Sig, Sig, Sig) -> (Sig, Sig, Sig)
forall a. (Num a, SigSpace a) => Sig -> a -> a -> a
cfd Sig
k (Sig
dry1, Sig
dry2, Sig
dry3) (Sig
wet1, Sig
wet2, Sig
wet3)

instance MixAt Sig (SE Sig) Sig4 where
    mixAt :: Sig
-> (Sig -> SE Sig)
-> (Sig, Sig, Sig, Sig)
-> AtOut Sig (SE Sig) (Sig, Sig, Sig, Sig)
mixAt Sig
k Sig -> SE Sig
f (Sig
dry1, Sig
dry2, Sig
dry3, Sig
dry4) = do
        Sig
wet1 <- Sig -> SE Sig
f Sig
dry1
        Sig
wet2 <- Sig -> SE Sig
f Sig
dry2
        Sig
wet3 <- Sig -> SE Sig
f Sig
dry3
        Sig
wet4 <- Sig -> SE Sig
f Sig
dry4
        (Sig, Sig, Sig, Sig) -> SE (Sig, Sig, Sig, Sig)
forall a. a -> SE a
forall (m :: * -> *) a. Monad m => a -> m a
return ((Sig, Sig, Sig, Sig) -> SE (Sig, Sig, Sig, Sig))
-> (Sig, Sig, Sig, Sig) -> SE (Sig, Sig, Sig, Sig)
forall a b. (a -> b) -> a -> b
$ Sig
-> (Sig, Sig, Sig, Sig)
-> (Sig, Sig, Sig, Sig)
-> (Sig, Sig, Sig, Sig)
forall a. (Num a, SigSpace a) => Sig -> a -> a -> a
cfd Sig
k (Sig
dry1, Sig
dry2, Sig
dry3, Sig
dry4) (Sig
wet1, Sig
wet2, Sig
wet3, Sig
wet4)

instance MixAt Sig (SE Sig) (SE Sig) where
    mixAt :: Sig -> (Sig -> SE Sig) -> SE Sig -> AtOut Sig (SE Sig) (SE Sig)
mixAt Sig
k Sig -> SE Sig
f SE Sig
dry = do
        Sig
dry1 <- SE Sig
dry
        Sig
wet1 <- Sig -> SE Sig
f Sig
dry1
        Sig -> SE Sig
forall a. a -> SE a
forall (m :: * -> *) a. Monad m => a -> m a
return (Sig -> SE Sig) -> Sig -> SE Sig
forall a b. (a -> b) -> a -> b
$ Sig -> Sig -> Sig -> Sig
forall a. (Num a, SigSpace a) => Sig -> a -> a -> a
cfd Sig
k Sig
dry1 Sig
wet1

instance MixAt Sig (SE Sig) (SE Sig2) where
    mixAt :: Sig -> (Sig -> SE Sig) -> SE Sig2 -> AtOut Sig (SE Sig) (SE Sig2)
mixAt Sig
k Sig -> SE Sig
f SE Sig2
dry = do
        (Sig
dry1, Sig
dry2) <- SE Sig2
dry
        Sig
wet1 <- Sig -> SE Sig
f Sig
dry1
        Sig
wet2 <- Sig -> SE Sig
f Sig
dry2
        Sig2 -> SE Sig2
forall a. a -> SE a
forall (m :: * -> *) a. Monad m => a -> m a
return (Sig2 -> SE Sig2) -> Sig2 -> SE Sig2
forall a b. (a -> b) -> a -> b
$ Sig -> Sig2 -> Sig2 -> Sig2
forall a. (Num a, SigSpace a) => Sig -> a -> a -> a
cfd Sig
k (Sig
dry1, Sig
dry2) (Sig
wet1, Sig
wet2)

instance MixAt Sig (SE Sig) (SE Sig3) where
    mixAt :: Sig
-> (Sig -> SE Sig)
-> SE (Sig, Sig, Sig)
-> AtOut Sig (SE Sig) (SE (Sig, Sig, Sig))
mixAt Sig
k Sig -> SE Sig
f SE (Sig, Sig, Sig)
dry = do
        (Sig
dry1, Sig
dry2, Sig
dry3) <- SE (Sig, Sig, Sig)
dry
        Sig
wet1 <- Sig -> SE Sig
f Sig
dry1
        Sig
wet2 <- Sig -> SE Sig
f Sig
dry2
        Sig
wet3 <- Sig -> SE Sig
f Sig
dry3
        (Sig, Sig, Sig) -> SE (Sig, Sig, Sig)
forall a. a -> SE a
forall (m :: * -> *) a. Monad m => a -> m a
return ((Sig, Sig, Sig) -> SE (Sig, Sig, Sig))
-> (Sig, Sig, Sig) -> SE (Sig, Sig, Sig)
forall a b. (a -> b) -> a -> b
$ Sig -> (Sig, Sig, Sig) -> (Sig, Sig, Sig) -> (Sig, Sig, Sig)
forall a. (Num a, SigSpace a) => Sig -> a -> a -> a
cfd Sig
k (Sig
dry1, Sig
dry2, Sig
dry3) (Sig
wet1, Sig
wet2, Sig
wet3)

instance MixAt Sig (SE Sig) (SE Sig4) where
    mixAt :: Sig
-> (Sig -> SE Sig)
-> SE (Sig, Sig, Sig, Sig)
-> AtOut Sig (SE Sig) (SE (Sig, Sig, Sig, Sig))
mixAt Sig
k Sig -> SE Sig
f SE (Sig, Sig, Sig, Sig)
dry = do
        (Sig
dry1, Sig
dry2, Sig
dry3, Sig
dry4) <- SE (Sig, Sig, Sig, Sig)
dry
        Sig
wet1 <- Sig -> SE Sig
f Sig
dry1
        Sig
wet2 <- Sig -> SE Sig
f Sig
dry2
        Sig
wet3 <- Sig -> SE Sig
f Sig
dry3
        Sig
wet4 <- Sig -> SE Sig
f Sig
dry4
        (Sig, Sig, Sig, Sig) -> SE (Sig, Sig, Sig, Sig)
forall a. a -> SE a
forall (m :: * -> *) a. Monad m => a -> m a
return ((Sig, Sig, Sig, Sig) -> SE (Sig, Sig, Sig, Sig))
-> (Sig, Sig, Sig, Sig) -> SE (Sig, Sig, Sig, Sig)
forall a b. (a -> b) -> a -> b
$ Sig
-> (Sig, Sig, Sig, Sig)
-> (Sig, Sig, Sig, Sig)
-> (Sig, Sig, Sig, Sig)
forall a. (Num a, SigSpace a) => Sig -> a -> a -> a
cfd Sig
k (Sig
dry1, Sig
dry2, Sig
dry3, Sig
dry4) (Sig
wet1, Sig
wet2, Sig
wet3, Sig
wet4)

-----------------------------------------------------
-- mono to stereo

instance MixAt Sig Sig2 Sig where
    mixAt :: Sig -> (Sig -> Sig2) -> Sig -> AtOut Sig Sig2 Sig
mixAt Sig
k Sig -> Sig2
f Sig
dry = Sig -> Sig2 -> Sig2 -> Sig2
forall a. (Num a, SigSpace a) => Sig -> a -> a -> a
cfd Sig
k (Sig
dry, Sig
dry) Sig2
wet
        where wet :: Sig2
wet = Sig -> Sig2
f Sig
dry

instance MixAt Sig Sig2 (SE Sig) where
    mixAt :: Sig -> (Sig -> Sig2) -> SE Sig -> AtOut Sig Sig2 (SE Sig)
mixAt Sig
k Sig -> Sig2
f SE Sig
dry = (Sig -> Sig2) -> SE Sig -> SE Sig2
forall a b. (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\Sig
x -> Sig -> Sig2 -> Sig2 -> Sig2
forall a. (Num a, SigSpace a) => Sig -> a -> a -> a
cfd Sig
k (Sig
x, Sig
x) (Sig -> Sig2
f Sig
x)) SE Sig
dry

instance MixAt Sig Sig2 Sig2 where
    mixAt :: Sig -> (Sig -> Sig2) -> Sig2 -> AtOut Sig Sig2 Sig2
mixAt Sig
k Sig -> Sig2
f Sig2
dry = Sig -> Sig2 -> Sig2 -> Sig2
forall a. (Num a, SigSpace a) => Sig -> a -> a -> a
cfd Sig
k Sig2
dry Sig2
wet
        where wet :: Sig2
wet = Sig2
0.5 Sig2 -> Sig2 -> Sig2
forall a. Num a => a -> a -> a
* (Sig -> Sig2
f (Sig2 -> Sig
forall a b. (a, b) -> a
fst Sig2
dry) Sig2 -> Sig2 -> Sig2
forall a. Num a => a -> a -> a
+ Sig -> Sig2
f (Sig2 -> Sig
forall a b. (a, b) -> b
snd Sig2
dry))

instance MixAt Sig Sig2 (SE Sig2) where
    mixAt :: Sig -> (Sig -> Sig2) -> SE Sig2 -> AtOut Sig Sig2 (SE Sig2)
mixAt Sig
k Sig -> Sig2
f SE Sig2
dry = do
        (Sig
dry1, Sig
dry2) <- SE Sig2
dry
        let wet :: Sig2
wet = Sig2
0.5 Sig2 -> Sig2 -> Sig2
forall a. Num a => a -> a -> a
* (Sig -> Sig2
f Sig
dry1 Sig2 -> Sig2 -> Sig2
forall a. Num a => a -> a -> a
+ Sig -> Sig2
f Sig
dry2)
        Sig2 -> SE Sig2
forall a. a -> SE a
forall (m :: * -> *) a. Monad m => a -> m a
return (Sig2 -> SE Sig2) -> Sig2 -> SE Sig2
forall a b. (a -> b) -> a -> b
$ Sig -> Sig2 -> Sig2 -> Sig2
forall a. (Num a, SigSpace a) => Sig -> a -> a -> a
cfd Sig
k (Sig
dry1, Sig
dry2) Sig2
wet

---------------------------------------------------------

---------------------------------------------------------
-- Sig2 -> Sig2

instance MixAt Sig2 Sig2 Sig where
    mixAt :: Sig -> (Sig2 -> Sig2) -> Sig -> AtOut Sig2 Sig2 Sig
mixAt Sig
k Sig2 -> Sig2
f Sig
dry1 = Sig -> Sig2 -> Sig2 -> Sig2
forall a. (Num a, SigSpace a) => Sig -> a -> a -> a
cfd Sig
k Sig2
dry Sig2
wet
        where
            dry :: Sig2
dry = Sig -> Sig2
fromMono Sig
dry1
            wet :: Sig2
wet = Sig2 -> Sig2
f Sig2
dry

instance MixAt Sig2 Sig2 Sig2 where
    mixAt :: Sig -> (Sig2 -> Sig2) -> Sig2 -> AtOut Sig2 Sig2 Sig2
mixAt Sig
k Sig2 -> Sig2
f Sig2
dry = Sig -> Sig2 -> Sig2 -> Sig2
forall a. (Num a, SigSpace a) => Sig -> a -> a -> a
cfd Sig
k Sig2
dry Sig2
wet
        where
            wet :: Sig2
wet = Sig2 -> Sig2
f Sig2
dry

instance MixAt Sig2 Sig2 (SE Sig) where
    mixAt :: Sig -> (Sig2 -> Sig2) -> SE Sig -> AtOut Sig2 Sig2 (SE Sig)
mixAt Sig
k Sig2 -> Sig2
f SE Sig
dry1 = do
        Sig2
dry <- (Sig -> Sig2) -> SE Sig -> SE Sig2
forall a b. (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Sig -> Sig2
fromMono SE Sig
dry1
        let wet :: Sig2
wet = Sig2 -> Sig2
f Sig2
dry
        Sig2 -> SE Sig2
forall a. a -> SE a
forall (m :: * -> *) a. Monad m => a -> m a
return (Sig2 -> SE Sig2) -> Sig2 -> SE Sig2
forall a b. (a -> b) -> a -> b
$ Sig -> Sig2 -> Sig2 -> Sig2
forall a. (Num a, SigSpace a) => Sig -> a -> a -> a
cfd Sig
k Sig2
dry Sig2
wet

instance MixAt Sig2 Sig2 (SE Sig2) where
    mixAt :: Sig -> (Sig2 -> Sig2) -> SE Sig2 -> AtOut Sig2 Sig2 (SE Sig2)
mixAt Sig
k Sig2 -> Sig2
f SE Sig2
drySe = do
        Sig2
dry <- SE Sig2
drySe
        let wet :: Sig2
wet = Sig2 -> Sig2
f Sig2
dry
        Sig2 -> SE Sig2
forall a. a -> SE a
forall (m :: * -> *) a. Monad m => a -> m a
return (Sig2 -> SE Sig2) -> Sig2 -> SE Sig2
forall a b. (a -> b) -> a -> b
$ Sig -> Sig2 -> Sig2 -> Sig2
forall a. (Num a, SigSpace a) => Sig -> a -> a -> a
cfd Sig
k Sig2
dry Sig2
wet


---------------------------------------------
-- Sig2 -> SE Sig2

instance MixAt Sig2 (SE Sig2) Sig where
    mixAt :: Sig -> (Sig2 -> SE Sig2) -> Sig -> AtOut Sig2 (SE Sig2) Sig
mixAt Sig
k Sig2 -> SE Sig2
f Sig
dry1 = do
        Sig2
wet <- Sig2 -> SE Sig2
f Sig2
dry
        Sig2 -> SE Sig2
forall a. a -> SE a
forall (m :: * -> *) a. Monad m => a -> m a
return (Sig2 -> SE Sig2) -> Sig2 -> SE Sig2
forall a b. (a -> b) -> a -> b
$ Sig -> Sig2 -> Sig2 -> Sig2
forall a. (Num a, SigSpace a) => Sig -> a -> a -> a
cfd Sig
k Sig2
dry Sig2
wet
        where
            dry :: Sig2
dry = Sig -> Sig2
fromMono Sig
dry1

instance MixAt Sig2 (SE Sig2) Sig2 where
    mixAt :: Sig -> (Sig2 -> SE Sig2) -> Sig2 -> AtOut Sig2 (SE Sig2) Sig2
mixAt Sig
k Sig2 -> SE Sig2
f Sig2
dry = do
        Sig2
wet <- Sig2 -> SE Sig2
f Sig2
dry
        Sig2 -> SE Sig2
forall a. a -> SE a
forall (m :: * -> *) a. Monad m => a -> m a
return (Sig2 -> SE Sig2) -> Sig2 -> SE Sig2
forall a b. (a -> b) -> a -> b
$ Sig -> Sig2 -> Sig2 -> Sig2
forall a. (Num a, SigSpace a) => Sig -> a -> a -> a
cfd Sig
k Sig2
dry Sig2
wet

instance MixAt Sig2 (SE Sig2) (SE Sig) where
    mixAt :: Sig -> (Sig2 -> SE Sig2) -> SE Sig -> AtOut Sig2 (SE Sig2) (SE Sig)
mixAt Sig
k Sig2 -> SE Sig2
f SE Sig
dry1 = do
        Sig2
dry <- (Sig -> Sig2) -> SE Sig -> SE Sig2
forall a b. (a -> b) -> SE a -> SE b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Sig -> Sig2
fromMono SE Sig
dry1
        Sig2
wet <- Sig2 -> SE Sig2
f Sig2
dry
        Sig2 -> SE Sig2
forall a. a -> SE a
forall (m :: * -> *) a. Monad m => a -> m a
return (Sig2 -> SE Sig2) -> Sig2 -> SE Sig2
forall a b. (a -> b) -> a -> b
$ Sig -> Sig2 -> Sig2 -> Sig2
forall a. (Num a, SigSpace a) => Sig -> a -> a -> a
cfd Sig
k Sig2
dry Sig2
wet

instance MixAt Sig2 (SE Sig2) (SE Sig2) where
    mixAt :: Sig
-> (Sig2 -> SE Sig2) -> SE Sig2 -> AtOut Sig2 (SE Sig2) (SE Sig2)
mixAt Sig
k Sig2 -> SE Sig2
f SE Sig2
drySe = do
        Sig2
dry <- SE Sig2
drySe
        Sig2
wet <- Sig2 -> SE Sig2
f Sig2
dry
        Sig2 -> SE Sig2
forall a. a -> SE a
forall (m :: * -> *) a. Monad m => a -> m a
return (Sig2 -> SE Sig2) -> Sig2 -> SE Sig2
forall a b. (a -> b) -> a -> b
$ Sig -> Sig2 -> Sig2 -> Sig2
forall a. (Num a, SigSpace a) => Sig -> a -> a -> a
cfd Sig
k Sig2
dry Sig2
wet