module Csound.Typed.Types(
module Csound.Typed.Types.Prim,
module Csound.Typed.Types.Lift,
withInits, withDs, withSigs, withTabs, withD, withSig, withTab, withSeed,
module Csound.Typed.Types.Tuple,
module Csound.Typed.Types.Evt,
module Csound.Typed.Types.Array,
module Csound.Typed.Types.MonoArg,
module Csound.Typed.Types.SigSpace,
getNextGlobalGenId
) where
import qualified Csound.Dynamic as D
import Csound.Typed.Types.Prim
import Csound.Typed.Types.Tuple
import Csound.Typed.Types.Evt
import Csound.Typed.Types.Lift
import Csound.Typed.Types.Array
import Csound.Typed.Types.MonoArg
import Csound.Typed.Types.SigSpace
import Csound.Typed.GlobalState(evalSE, SE, geToSe)
import qualified Csound.Typed.GlobalState as G(getNextGlobalGenId)
getNextGlobalGenId :: SE Int
getNextGlobalGenId :: SE Int
getNextGlobalGenId = GE Int -> SE Int
forall a. GE a -> SE a
geToSe GE Int
G.getNextGlobalGenId
withInits :: (Tuple a, Tuple b) => a -> b -> a
withInits :: a -> b -> a
withInits a
a b
b = a -> GE [E] -> a
forall a. Tuple a => a -> GE [E] -> a
genWithInits a
a (b -> GE [E]
forall a. Tuple a => a -> GE [E]
fromTuple b
b)
withDs :: Tuple a => a -> [D] -> a
withDs :: a -> [D] -> a
withDs a
a [D]
ds = a -> GE [E] -> a
forall a. Tuple a => a -> GE [E] -> a
genWithInits a
a ((D -> GE E) -> [D] -> GE [E]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM D -> GE E
forall a. Val a => a -> GE E
toGE [D]
ds)
withD :: Tuple a => a -> D -> a
withD :: a -> D -> a
withD = a -> D -> a
forall a b. (Tuple a, Tuple b) => a -> b -> a
withInits
withSigs :: Tuple a => a -> [Sig] -> a
withSigs :: a -> [Sig] -> a
withSigs a
a [Sig]
sigs = a -> GE [E] -> a
forall a. Tuple a => a -> GE [E] -> a
genWithInits a
a ((Sig -> GE E) -> [Sig] -> GE [E]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM Sig -> GE E
forall a. Val a => a -> GE E
toGE [Sig]
sigs)
withSig :: Tuple a => a -> Sig -> a
withSig :: a -> Sig -> a
withSig = a -> Sig -> a
forall a b. (Tuple a, Tuple b) => a -> b -> a
withInits
withTabs :: Tuple a => a -> [Tab] -> a
withTabs :: a -> [Tab] -> a
withTabs a
a [Tab]
tabs = a -> GE [E] -> a
forall a. Tuple a => a -> GE [E] -> a
genWithInits a
a ((Tab -> GE E) -> [Tab] -> GE [E]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM Tab -> GE E
forall a. Val a => a -> GE E
toGE [Tab]
tabs)
withTab :: Tuple a => a -> Tab -> a
withTab :: a -> Tab -> a
withTab = a -> Tab -> a
forall a b. (Tuple a, Tuple b) => a -> b -> a
withInits
withSeed :: SE Sig -> D -> Sig
withSeed :: SE Sig -> D -> Sig
withSeed SE Sig
a D
d = GE Sig -> Sig
forall a. Val a => GE a -> a
hideGE (GE Sig -> Sig) -> GE Sig -> Sig
forall a b. (a -> b) -> a -> b
$ SE Sig -> GE Sig
forall a. SE a -> GE a
evalSE (SE Sig -> GE Sig) -> SE Sig -> GE Sig
forall a b. (a -> b) -> a -> b
$ (Sig -> Sig) -> SE Sig -> SE Sig
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((Sig -> D -> Sig) -> D -> Sig -> Sig
forall a b c. (a -> b -> c) -> b -> a -> c
flip Sig -> D -> Sig
forall a. Tuple a => a -> D -> a
withD D
d) SE Sig
a
genWithInits :: (Tuple a) => a -> GE [E] -> a
genWithInits :: a -> GE [E] -> a
genWithInits a
a GE [E]
vals = GE [E] -> a
forall a. Tuple a => GE [E] -> a
toTuple (GE [E] -> a) -> GE [E] -> a
forall a b. (a -> b) -> a -> b
$ do
[E]
as <- a -> GE [E]
forall a. Tuple a => a -> GE [E]
fromTuple a
a
[E]
vs <- GE [E]
vals
[E] -> GE [E]
forall (m :: * -> *) a. Monad m => a -> m a
return ([E] -> GE [E]) -> [E] -> GE [E]
forall a b. (a -> b) -> a -> b
$ (E -> E) -> [E] -> [E]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\E
x -> E -> [E] -> E
D.withInits E
x [E]
vs) [E]
as