hsc3-0.20: Haskell SuperCollider
Safe HaskellSafe-Inferred
LanguageHaskell2010

Sound.Sc3.Common.Uid

Description

Unique identifier types and classes. Used by non-deterministic (noise) and non-sharable (demand) unit generators.

Synopsis

Id & Uid

type Id = Int Source #

Identifiers are integers.

class (Functor m, Applicative m, Monad m) => Uid m where Source #

A class indicating a monad (and functor and applicative) that will generate a sequence of unique integer identifiers.

Methods

generateUid :: m Int Source #

Instances

Instances details
Uid IO Source # 
Instance details

Defined in Sound.Sc3.Common.Uid

Uid m => Uid (ReaderT t m) Source # 
Instance details

Defined in Sound.Sc3.Common.Uid

Uid (StateT Int Identity) Source #

Requires FlexibleInstances.

Instance details

Defined in Sound.Sc3.Common.Uid

Uid_St

uid_st_eval :: Uid_St t -> t Source #

evalState with initial state of zero.

uid_st_eval (replicateM 3 generateUid) == [0, 1, 2]

uid_st_seq :: [Uid_St t] -> ([t], Int) Source #

Thread state through sequence of runState.

uid_st_seq_ :: [Uid_St t] -> [t] Source #

fst of uid_st_seq.

uid_st_seq_ (replicate 3 generateUid) == [0, 1, 2]

Lift

liftUid1 :: Uid m => (Int -> Fn1 a b) -> Fn1 a (m b) Source #

Unary Uid lift.

liftUid2 :: Uid m => (Int -> Fn2 a b c) -> Fn2 a b (m c) Source #

Binary Uid lift.

liftUid3 :: Uid m => (Int -> Fn3 a b c d) -> Fn3 a b c (m d) Source #

Ternary Uid lift.

liftUid4 :: Uid m => (Int -> Fn4 a b c d e) -> Fn4 a b c d (m e) Source #

Quaternary Uid lift.

liftUid5 :: Uid m => (Int -> Fn5 a b c d e f) -> Fn5 a b c d e (m f) Source #

5-parameter Uid lift.

liftUid6 :: Uid m => (Int -> Fn6 a b c d e f g) -> Fn6 a b c d e f (m g) Source #

6-parameter Uid lift.

liftUid10 :: Uid m => (Int -> Fn10 a b c d e f g h i j k) -> Fn10 a b c d e f g h i j (m k) Source #

10-parameter Uid lift.

liftUid11 :: Uid m => (Int -> Fn11 a b c d e f g h i j k l) -> Fn11 a b c d e f g h i j k (m l) Source #

11-parameter Uid lift.

ID

class Hashable32 a => ID a where Source #

Typeclass to constrain Ugen identifiers. Char inputs are hashed to generate longer seeds for when ir (constant) random Ugens are optimised.

map resolveID [0::Int,1] == [0, 1]
map resolveID ['α', 'β'] == [1439603815, 4131151318]
map resolveID [('α', 'β'),('β', 'α')] == [3538183581, 3750624898]
map resolveID [('α',('α', 'β')),('β',('α', 'β'))] == [0020082907, 2688286317]
map resolveID [('α', 'α', 'β'),('β', 'α', 'β')] == [0020082907, 2688286317]

Minimal complete definition

Nothing

Methods

resolveID :: a -> Id Source #

Instances

Instances details
ID Char Source # 
Instance details

Defined in Sound.Sc3.Common.Uid

Methods

resolveID :: Char -> Id Source #

ID Int Source # 
Instance details

Defined in Sound.Sc3.Common.Uid

Methods

resolveID :: Int -> Id Source #

(ID p, ID q) => ID (p, q) Source # 
Instance details

Defined in Sound.Sc3.Common.Uid

Methods

resolveID :: (p, q) -> Id Source #

(ID p, ID q, ID r) => ID (p, q, r) Source # 
Instance details

Defined in Sound.Sc3.Common.Uid

Methods

resolveID :: (p, q, r) -> Id Source #

id_seq :: ID a => Int -> a -> [Id] Source #

n identifiers from x.

id_seq 10 'α' == [1439603815 .. 1439603824]