Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- (++) :: [a] -> [a] -> [a]
- filter :: (a -> Bool) -> [a] -> [a]
- zip :: [a] -> [b] -> [(a, b)]
- map :: (a -> b) -> [a] -> [b]
- (<$) :: Functor f => a -> f b -> f a
- class Functor f => Applicative (f :: * -> *) where
- foldr :: Foldable t => (a -> b -> b) -> b -> t a -> b
- length :: Foldable t => t a -> Int
- null :: Foldable t => t a -> Bool
- foldl :: Foldable t => (b -> a -> b) -> b -> t a -> b
- foldl' :: Foldable t => (b -> a -> b) -> b -> t a -> b
- foldl1 :: Foldable t => (a -> a -> a) -> t a -> a
- sum :: (Foldable t, Num a) => t a -> a
- product :: (Foldable t, Num a) => t a -> a
- foldr1 :: Foldable t => (a -> a -> a) -> t a -> a
- maximum :: (Foldable t, Ord a) => t a -> a
- minimum :: (Foldable t, Ord a) => t a -> a
- elem :: (Foldable t, Eq a) => a -> t a -> Bool
- (<>) :: Semigroup a => a -> a -> a
- class Semigroup a => Monoid a where
- data Ratio a
- type Rational = Ratio Integer
- forkOnWithUnmask :: Int -> ((forall a. IO a -> IO a) -> IO ()) -> IO ThreadId
- forkIOWithUnmask :: ((forall a. IO a -> IO a) -> IO ()) -> IO ThreadId
- forkOn :: Int -> IO () -> IO ThreadId
- forkOS :: IO () -> IO ThreadId
- data ThreadId
- class Applicative f => Alternative (f :: * -> *) where
- threadWaitWriteSTM :: Fd -> IO (STM (), IO ())
- threadWaitReadSTM :: Fd -> IO (STM (), IO ())
- threadWaitWrite :: Fd -> IO ()
- threadWaitRead :: Fd -> IO ()
- runInUnboundThread :: IO a -> IO a
- runInBoundThread :: IO a -> IO a
- isCurrentThreadBound :: IO Bool
- forkOSWithUnmask :: ((forall a. IO a -> IO a) -> IO ()) -> IO ThreadId
- forkFinally :: IO a -> (Either SomeException a -> IO ()) -> IO ThreadId
- rtsSupportsBoundThreads :: Bool
- writeList2Chan :: Chan a -> [a] -> IO ()
- getChanContents :: Chan a -> IO [a]
- dupChan :: Chan a -> IO (Chan a)
- readChan :: Chan a -> IO a
- writeChan :: Chan a -> a -> IO ()
- newChan :: IO (Chan a)
- data Chan a
- signalQSem :: QSem -> IO ()
- waitQSem :: QSem -> IO ()
- newQSem :: Int -> IO QSem
- data QSem
- signalQSemN :: QSemN -> Int -> IO ()
- waitQSemN :: QSemN -> Int -> IO ()
- newQSemN :: Int -> IO QSemN
- data QSemN
- approxRational :: RealFrac a => a -> a -> Rational
- isSubsequenceOf :: Eq a => [a] -> [a] -> Bool
- mapAccumR :: Traversable t => (a -> b -> (a, c)) -> a -> t b -> (a, t c)
- mapAccumL :: Traversable t => (a -> b -> (a, c)) -> a -> t b -> (a, t c)
- optional :: Alternative f => f a -> f (Maybe a)
- newtype WrappedMonad (m :: * -> *) a = WrapMonad {
- unwrapMonad :: m a
- newtype WrappedArrow (a :: * -> * -> *) b c = WrapArrow {
- unwrapArrow :: a b c
- newtype ZipList a = ZipList {
- getZipList :: [a]
- threadDelay :: Int -> IO ()
- mkWeakMVar :: MVar a -> IO () -> IO (Weak (MVar a))
- addMVarFinalizer :: MVar a -> IO () -> IO ()
- modifyMVarMasked :: MVar a -> (a -> IO (a, b)) -> IO b
- modifyMVarMasked_ :: MVar a -> (a -> IO a) -> IO ()
- modifyMVar :: MVar a -> (a -> IO (a, b)) -> IO b
- modifyMVar_ :: MVar a -> (a -> IO a) -> IO ()
- withMVarMasked :: MVar a -> (a -> IO b) -> IO b
- withMVar :: MVar a -> (a -> IO b) -> IO b
- swapMVar :: MVar a -> a -> IO a
- mkWeakThreadId :: ThreadId -> IO (Weak ThreadId)
- threadCapability :: ThreadId -> IO (Int, Bool)
- yield :: IO ()
- myThreadId :: IO ThreadId
- throwTo :: Exception e => ThreadId -> e -> IO ()
- killThread :: ThreadId -> IO ()
- setNumCapabilities :: Int -> IO ()
- getNumCapabilities :: IO Int
- forkIO :: IO () -> IO ThreadId
- newtype Const a (b :: k) :: forall k. * -> k -> * = Const {
- getConst :: a
- find :: Foldable t => (a -> Bool) -> t a -> Maybe a
- notElem :: (Foldable t, Eq a) => a -> t a -> Bool
- minimumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a
- maximumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a
- all :: Foldable t => (a -> Bool) -> t a -> Bool
- any :: Foldable t => (a -> Bool) -> t a -> Bool
- or :: Foldable t => t Bool -> Bool
- and :: Foldable t => t Bool -> Bool
- concatMap :: Foldable t => (a -> [b]) -> t a -> [b]
- concat :: Foldable t => t [a] -> [a]
- newtype First a = First {}
- newtype Last a = Last {}
- newtype Dual a = Dual {
- getDual :: a
- newtype Endo a = Endo {
- appEndo :: a -> a
- newtype All = All {}
- newtype Any = Any {}
- newtype Sum a = Sum {
- getSum :: a
- newtype Product a = Product {
- getProduct :: a
- newtype Alt (f :: k -> *) (a :: k) :: forall k. (k -> *) -> k -> * = Alt {
- getAlt :: f a
- unwords :: [String] -> String
- words :: String -> [String]
- unlines :: [String] -> String
- lines :: String -> [String]
- unfoldr :: (b -> Maybe (a, b)) -> b -> [a]
- sortOn :: Ord b => (a -> b) -> [a] -> [a]
- sortBy :: (a -> a -> Ordering) -> [a] -> [a]
- sort :: Ord a => [a] -> [a]
- permutations :: [a] -> [[a]]
- subsequences :: [a] -> [[a]]
- tails :: [a] -> [[a]]
- inits :: [a] -> [[a]]
- groupBy :: (a -> a -> Bool) -> [a] -> [[a]]
- group :: Eq a => [a] -> [[a]]
- deleteFirstsBy :: (a -> a -> Bool) -> [a] -> [a] -> [a]
- unzip7 :: [(a, b, c, d, e, f, g)] -> ([a], [b], [c], [d], [e], [f], [g])
- unzip6 :: [(a, b, c, d, e, f)] -> ([a], [b], [c], [d], [e], [f])
- unzip5 :: [(a, b, c, d, e)] -> ([a], [b], [c], [d], [e])
- unzip4 :: [(a, b, c, d)] -> ([a], [b], [c], [d])
- zipWith7 :: (a -> b -> c -> d -> e -> f -> g -> h) -> [a] -> [b] -> [c] -> [d] -> [e] -> [f] -> [g] -> [h]
- zipWith6 :: (a -> b -> c -> d -> e -> f -> g) -> [a] -> [b] -> [c] -> [d] -> [e] -> [f] -> [g]
- zipWith5 :: (a -> b -> c -> d -> e -> f) -> [a] -> [b] -> [c] -> [d] -> [e] -> [f]
- zipWith4 :: (a -> b -> c -> d -> e) -> [a] -> [b] -> [c] -> [d] -> [e]
- zip7 :: [a] -> [b] -> [c] -> [d] -> [e] -> [f] -> [g] -> [(a, b, c, d, e, f, g)]
- zip6 :: [a] -> [b] -> [c] -> [d] -> [e] -> [f] -> [(a, b, c, d, e, f)]
- zip5 :: [a] -> [b] -> [c] -> [d] -> [e] -> [(a, b, c, d, e)]
- zip4 :: [a] -> [b] -> [c] -> [d] -> [(a, b, c, d)]
- genericReplicate :: Integral i => i -> a -> [a]
- genericIndex :: Integral i => [a] -> i -> a
- genericSplitAt :: Integral i => i -> [a] -> ([a], [a])
- genericDrop :: Integral i => i -> [a] -> [a]
- genericTake :: Integral i => i -> [a] -> [a]
- genericLength :: Num i => [a] -> i
- insertBy :: (a -> a -> Ordering) -> a -> [a] -> [a]
- insert :: Ord a => a -> [a] -> [a]
- partition :: (a -> Bool) -> [a] -> ([a], [a])
- transpose :: [[a]] -> [[a]]
- intercalate :: [a] -> [[a]] -> [a]
- intersperse :: a -> [a] -> [a]
- intersectBy :: (a -> a -> Bool) -> [a] -> [a] -> [a]
- intersect :: Eq a => [a] -> [a] -> [a]
- unionBy :: (a -> a -> Bool) -> [a] -> [a] -> [a]
- union :: Eq a => [a] -> [a] -> [a]
- (\\) :: Eq a => [a] -> [a] -> [a]
- deleteBy :: (a -> a -> Bool) -> a -> [a] -> [a]
- delete :: Eq a => a -> [a] -> [a]
- nubBy :: (a -> a -> Bool) -> [a] -> [a]
- nub :: Eq a => [a] -> [a]
- isInfixOf :: Eq a => [a] -> [a] -> Bool
- isSuffixOf :: Eq a => [a] -> [a] -> Bool
- isPrefixOf :: Eq a => [a] -> [a] -> Bool
- findIndices :: (a -> Bool) -> [a] -> [Int]
- findIndex :: (a -> Bool) -> [a] -> Maybe Int
- elemIndices :: Eq a => a -> [a] -> [Int]
- elemIndex :: Eq a => a -> [a] -> Maybe Int
- stripPrefix :: Eq a => [a] -> [a] -> Maybe [a]
- dropWhileEnd :: (a -> Bool) -> [a] -> [a]
- (<$>) :: Functor f => (a -> b) -> f a -> f b
- denominator :: Ratio a -> a
- numerator :: Ratio a -> a
- (%) :: Integral a => a -> a -> Ratio a
- unzip3 :: [(a, b, c)] -> ([a], [b], [c])
- unzip :: [(a, b)] -> ([a], [b])
- zipWith3 :: (a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d]
- zipWith :: (a -> b -> c) -> [a] -> [b] -> [c]
- zip3 :: [a] -> [b] -> [c] -> [(a, b, c)]
- (!!) :: [a] -> Int -> a
- lookup :: Eq a => a -> [(a, b)] -> Maybe b
- reverse :: [a] -> [a]
- break :: (a -> Bool) -> [a] -> ([a], [a])
- span :: (a -> Bool) -> [a] -> ([a], [a])
- splitAt :: Int -> [a] -> ([a], [a])
- drop :: Int -> [a] -> [a]
- take :: Int -> [a] -> [a]
- dropWhile :: (a -> Bool) -> [a] -> [a]
- takeWhile :: (a -> Bool) -> [a] -> [a]
- cycle :: [a] -> [a]
- replicate :: Int -> a -> [a]
- repeat :: a -> [a]
- iterate' :: (a -> a) -> a -> [a]
- iterate :: (a -> a) -> a -> [a]
- scanr1 :: (a -> a -> a) -> [a] -> [a]
- scanr :: (a -> b -> b) -> b -> [a] -> [b]
- scanl' :: (b -> a -> b) -> b -> [a] -> [b]
- scanl1 :: (a -> a -> a) -> [a] -> [a]
- scanl :: (b -> a -> b) -> b -> [a] -> [b]
- foldl1' :: (a -> a -> a) -> [a] -> a
- init :: [a] -> [a]
- last :: [a] -> a
- tail :: [a] -> [a]
- uncons :: [a] -> Maybe (a, [a])
- head :: [a] -> a
- isEmptyMVar :: MVar a -> IO Bool
- tryReadMVar :: MVar a -> IO (Maybe a)
- tryPutMVar :: MVar a -> a -> IO Bool
- tryTakeMVar :: MVar a -> IO (Maybe a)
- putMVar :: MVar a -> a -> IO ()
- readMVar :: MVar a -> IO a
- takeMVar :: MVar a -> IO a
- newMVar :: a -> IO (MVar a)
- newEmptyMVar :: IO (MVar a)
- data MVar a
- liftA3 :: Applicative f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d
- liftA :: Applicative f => (a -> b) -> f a -> f b
- (<**>) :: Applicative f => f a -> f (a -> b) -> f b
- type Event a = (Arc, Arc, a)
- type Arc = (Time, Time)
- type Time = Rational
- sam :: Time -> Time
- nextSam :: Time -> Time
- cyclePos :: Time -> Time
- isIn :: Arc -> Time -> Bool
- arcCycles :: Arc -> [Arc]
- arcCycles' :: Arc -> [Arc]
- subArc :: Arc -> Arc -> Maybe Arc
- mapArc :: (Time -> Time) -> Arc -> Arc
- mapCycle :: (Time -> Time) -> Arc -> Arc
- mirrorArc :: Time -> Arc -> Arc
- eventStart :: Event a -> Time
- eventOnset :: Event a -> Time
- eventOffset :: Event a -> Time
- eventArc :: Event a -> Arc
- midPoint :: Arc -> Time
- hasOnset :: Event a -> Bool
- hasOffset :: Event a -> Bool
- onsetIn :: Arc -> Event a -> Bool
- offsetIn :: Arc -> Event a -> Bool
- data TConnection = TConnection Unique Connection
- data ServerMode
- type ClientState = [TConnection]
- data Tempo = Tempo {}
- wsConn :: TConnection -> Connection
- getLatency :: IO Double
- getClockIp :: IO String
- getServerPort :: IO Int
- getMasterPort :: IO Int
- getSlavePort :: IO Int
- readTempo :: String -> Tempo
- logicalTime :: Tempo -> Double -> Double
- beatNow :: Tempo -> IO Double
- getCurrentBeat :: MVar Tempo -> IO Rational
- clientApp :: MVar Tempo -> MVar Double -> MVar Double -> ClientApp ()
- sendTempo :: [Connection] -> Tempo -> IO ()
- sendCps :: Connection -> MVar Double -> IO ()
- sendNudge :: Connection -> MVar Double -> IO ()
- connectClient :: Bool -> String -> MVar Tempo -> MVar Double -> MVar Double -> IO ()
- runClient :: IO (MVar Tempo, MVar Double, MVar Double)
- cpsUtils' :: IO (Double -> IO (), Double -> IO (), IO Rational)
- cpsUtils :: IO (Double -> IO (), IO Rational)
- bpsUtils :: IO (Double -> IO (), IO Rational)
- cpsSetter :: IO (Double -> IO ())
- clocked :: (Tempo -> Int -> IO ()) -> IO ()
- clockedTick :: Int -> (Tempo -> Int -> IO ()) -> IO ()
- updateTempo :: Tempo -> Double -> IO Tempo
- nudgeTempo :: Tempo -> Double -> Tempo
- removeClient :: TConnection -> ClientState -> ClientState
- broadcast :: Text -> ClientState -> IO ()
- startServer :: IO ThreadId
- serverApp :: MVar Tempo -> MVar ServerMode -> MVar ClientState -> ServerApp
- slave :: MVar ServerMode -> MVar ClientState -> IO ()
- slaveAct :: String -> MVar ServerMode -> MVar ClientState -> Message -> IO ()
- setSlave :: MVar ServerMode -> IO ()
- serverLoop :: TConnection -> MVar Tempo -> MVar ServerMode -> MVar ClientState -> IO ()
- serverAct :: String -> ServerMode -> MVar Tempo -> MVar ClientState -> IO ()
- setCps :: Double -> ServerMode -> MVar Tempo -> MVar ClientState -> IO ()
- setNudge :: Double -> ServerMode -> MVar Tempo -> MVar ClientState -> IO ()
- newtype Pattern a = Pattern {}
- noOv :: String -> a
- showTime :: (Show a, Integral a) => Ratio a -> String
- showArc :: Arc -> String
- showEvent :: Show a => Event a -> String
- unwrap :: Pattern (Pattern a) -> Pattern a
- atom :: a -> Pattern a
- silence :: Pattern a
- withQueryArc :: (Arc -> Arc) -> Pattern a -> Pattern a
- withQueryTime :: (Time -> Time) -> Pattern a -> Pattern a
- withResultArc :: (Arc -> Arc) -> Pattern a -> Pattern a
- withResultTime :: (Time -> Time) -> Pattern a -> Pattern a
- withEvent :: (Event a -> Event b) -> Pattern a -> Pattern b
- timedValues :: Pattern a -> Pattern (Arc, a)
- overlay :: Pattern a -> Pattern a -> Pattern a
- stack :: [Pattern a] -> Pattern a
- append :: Pattern a -> Pattern a -> Pattern a
- append' :: Pattern a -> Pattern a -> Pattern a
- fastcat :: [Pattern a] -> Pattern a
- splitAtSam :: Pattern a -> Pattern a
- slowcat :: [Pattern a] -> Pattern a
- cat :: [Pattern a] -> Pattern a
- listToPat :: [a] -> Pattern a
- patToList :: Pattern a -> [a]
- maybeListToPat :: [Maybe a] -> Pattern a
- run :: (Enum a, Num a) => Pattern a -> Pattern a
- _run :: (Enum a, Num a) => a -> Pattern a
- scan :: (Enum a, Num a) => Pattern a -> Pattern a
- _scan :: (Enum a, Num a) => a -> Pattern a
- temporalParam :: (a -> Pattern b -> Pattern c) -> Pattern a -> Pattern b -> Pattern c
- temporalParam2 :: (a -> b -> Pattern c -> Pattern d) -> Pattern a -> Pattern b -> Pattern c -> Pattern d
- temporalParam3 :: (a -> b -> c -> Pattern d -> Pattern e) -> Pattern a -> Pattern b -> Pattern c -> Pattern d -> Pattern e
- temporalParam' :: (a -> Pattern b -> Pattern c) -> Pattern a -> Pattern b -> Pattern c
- temporalParam2' :: (a -> b -> Pattern c -> Pattern d) -> Pattern a -> Pattern b -> Pattern c -> Pattern d
- temporalParam3' :: (a -> b -> c -> Pattern d -> Pattern e) -> Pattern a -> Pattern b -> Pattern c -> Pattern d -> Pattern e
- fast :: Pattern Time -> Pattern a -> Pattern a
- _fast :: Time -> Pattern a -> Pattern a
- fast' :: Pattern Time -> Pattern a -> Pattern a
- density :: Pattern Time -> Pattern a -> Pattern a
- _density :: Time -> Pattern a -> Pattern a
- fastGap :: Time -> Pattern a -> Pattern a
- densityGap :: Time -> Pattern a -> Pattern a
- slow :: Pattern Time -> Pattern a -> Pattern a
- sparsity :: Pattern Time -> Pattern a -> Pattern a
- slow' :: Pattern Time -> Pattern a -> Pattern a
- _slow :: Time -> Pattern a -> Pattern a
- rotL :: Time -> Pattern a -> Pattern a
- (<~) :: Pattern Time -> Pattern a -> Pattern a
- rotR :: Time -> Pattern a -> Pattern a
- (~>) :: Pattern Time -> Pattern a -> Pattern a
- brak :: Pattern a -> Pattern a
- iter :: Pattern Int -> Pattern c -> Pattern c
- _iter :: Int -> Pattern a -> Pattern a
- iter' :: Pattern Int -> Pattern c -> Pattern c
- _iter' :: Int -> Pattern a -> Pattern a
- rev :: Pattern a -> Pattern a
- palindrome :: Pattern a -> Pattern a
- when :: (Int -> Bool) -> (Pattern a -> Pattern a) -> Pattern a -> Pattern a
- whenT :: (Time -> Bool) -> (Pattern a -> Pattern a) -> Pattern a -> Pattern a
- playWhen :: (Time -> Bool) -> Pattern a -> Pattern a
- playFor :: Time -> Time -> Pattern a -> Pattern a
- seqP :: [(Time, Time, Pattern a)] -> Pattern a
- every :: Pattern Int -> (Pattern a -> Pattern a) -> Pattern a -> Pattern a
- _every :: Int -> (Pattern a -> Pattern a) -> Pattern a -> Pattern a
- every' :: Pattern Int -> Pattern Int -> (Pattern a -> Pattern a) -> Pattern a -> Pattern a
- _every' :: Int -> Int -> (Pattern a -> Pattern a) -> Pattern a -> Pattern a
- foldEvery :: [Int] -> (Pattern a -> Pattern a) -> Pattern a -> Pattern a
- sig :: (Time -> a) -> Pattern a
- sinewave :: Fractional a => Pattern a
- sine :: Fractional a => Pattern a
- cosine :: Fractional a => Pattern a
- sineAmp :: Fractional a => a -> Pattern a
- sawwave :: (Fractional a, Real a) => Pattern a
- saw :: (Fractional a, Real a) => Pattern a
- triwave :: (Fractional a, Real a) => Pattern a
- tri :: (Fractional a, Real a) => Pattern a
- squarewave :: (Fractional a, Real a) => Pattern a
- square :: (Fractional a, Real a) => Pattern a
- sinewave1 :: Fractional a => Pattern a
- sine1 :: Fractional a => Pattern a
- sinerat :: Pattern Double
- ratsine :: Pattern Double
- sinerat1 :: Pattern Double
- sineAmp1 :: Fractional a => a -> Pattern a
- sawwave1 :: (Fractional a, Real a) => Pattern a
- saw1 :: (Fractional a, Real a) => Pattern a
- sawrat :: Pattern Double
- sawrat1 :: Pattern Double
- triwave1 :: (Fractional a, Real a) => Pattern a
- tri1 :: (Fractional a, Real a) => Pattern a
- trirat :: Pattern Double
- trirat1 :: Pattern Double
- squarewave1 :: (Fractional a, Real a) => Pattern a
- square1 :: (Fractional a, Real a) => Pattern a
- envL :: Pattern Double
- envLR :: Pattern Double
- envEq :: Pattern Double
- envEqR :: Pattern Double
- fadeOut :: Time -> Pattern a -> Pattern a
- fadeOut' :: Time -> Time -> Pattern a -> Pattern a
- fadeIn' :: Time -> Time -> Pattern a -> Pattern a
- fadeIn :: Time -> Pattern a -> Pattern a
- spread :: (a -> t -> Pattern b) -> [a] -> t -> Pattern b
- slowspread :: (a -> t -> Pattern b) -> [a] -> t -> Pattern b
- fastspread :: (a -> t -> Pattern b) -> [a] -> t -> Pattern b
- spread' :: Monad m => (a -> b -> m c) -> m a -> b -> m c
- spreadChoose :: (t -> t1 -> Pattern b) -> [t] -> t1 -> Pattern b
- spreadr :: (t -> t1 -> Pattern b) -> [t] -> t1 -> Pattern b
- filterValues :: (a -> Bool) -> Pattern a -> Pattern a
- filterJust :: Pattern (Maybe a) -> Pattern a
- filterOnsets :: Pattern a -> Pattern a
- filterStartInRange :: Pattern a -> Pattern a
- filterOnsetsInRange :: Pattern a -> Pattern a
- seqToRelOnsetDeltas :: Arc -> Pattern a -> [(Double, Double, a)]
- segment :: Pattern a -> Pattern [a]
- segment' :: [Event a] -> [Event a]
- split :: Time -> [Event a] -> [Event a]
- points :: [Event a] -> [Time]
- groupByTime :: [Event a] -> [Event [a]]
- ifp :: (Int -> Bool) -> (Pattern a -> Pattern a) -> (Pattern a -> Pattern a) -> Pattern a -> Pattern a
- rand :: Pattern Double
- timeToRand :: RealFrac r => r -> Double
- irand :: Num a => Int -> Pattern a
- choose :: [a] -> Pattern a
- degradeBy :: Pattern Double -> Pattern a -> Pattern a
- _degradeBy :: Double -> Pattern a -> Pattern a
- unDegradeBy :: Pattern Double -> Pattern a -> Pattern a
- _unDegradeBy :: Double -> Pattern a -> Pattern a
- degradeOverBy :: Int -> Pattern Double -> Pattern a -> Pattern a
- sometimesBy :: Double -> (Pattern a -> Pattern a) -> Pattern a -> Pattern a
- sometimes :: (Pattern a -> Pattern a) -> Pattern a -> Pattern a
- often :: (Pattern a -> Pattern a) -> Pattern a -> Pattern a
- rarely :: (Pattern a -> Pattern a) -> Pattern a -> Pattern a
- almostNever :: (Pattern a -> Pattern a) -> Pattern a -> Pattern a
- almostAlways :: (Pattern a -> Pattern a) -> Pattern a -> Pattern a
- never :: (Pattern a -> Pattern a) -> Pattern a -> Pattern a
- always :: (Pattern a -> Pattern a) -> Pattern a -> Pattern a
- someCyclesBy :: Double -> (Pattern a -> Pattern a) -> Pattern a -> Pattern a
- somecyclesBy :: Double -> (Pattern a -> Pattern a) -> Pattern a -> Pattern a
- someCycles :: (Pattern a -> Pattern a) -> Pattern a -> Pattern a
- somecycles :: (Pattern a -> Pattern a) -> Pattern a -> Pattern a
- degrade :: Pattern a -> Pattern a
- wedge :: Time -> Pattern a -> Pattern a -> Pattern a
- timeCat :: [(Time, Pattern a)] -> Pattern a
- whenmod :: Int -> Int -> (Pattern a -> Pattern a) -> Pattern a -> Pattern a
- superimpose :: (Pattern a -> Pattern a) -> Pattern a -> Pattern a
- splitQueries :: Pattern a -> Pattern a
- trunc :: Pattern Time -> Pattern a -> Pattern a
- _trunc :: Time -> Pattern a -> Pattern a
- linger :: Pattern Time -> Pattern a -> Pattern a
- _linger :: Time -> Pattern a -> Pattern a
- zoom :: Arc -> Pattern a -> Pattern a
- compress :: Arc -> Pattern a -> Pattern a
- sliceArc :: Arc -> Pattern a -> Pattern a
- within :: Arc -> (Pattern a -> Pattern a) -> Pattern a -> Pattern a
- within' :: Arc -> (Pattern a -> Pattern a) -> Pattern a -> Pattern a
- revArc :: Arc -> Pattern a -> Pattern a
- e :: Pattern Int -> Pattern Int -> Pattern a -> Pattern a
- _e :: Int -> Int -> Pattern a -> Pattern a
- e' :: Pattern Int -> Pattern Int -> Pattern a -> Pattern a
- _e' :: Int -> Int -> Pattern a -> Pattern a
- distrib :: [Pattern Int] -> Pattern a -> Pattern a
- _distrib :: [Int] -> Pattern a -> Pattern a
- einv :: Pattern Int -> Pattern Int -> Pattern a -> Pattern a
- _einv :: Int -> Int -> Pattern a -> Pattern a
- efull :: Pattern Int -> Pattern Int -> Pattern a -> Pattern a -> Pattern a
- index :: Real b => b -> Pattern b -> Pattern c -> Pattern c
- prrw :: (a -> b -> c) -> Int -> (Time, Time) -> Pattern a -> Pattern b -> Pattern c
- prr :: Int -> (Time, Time) -> Pattern String -> Pattern b -> Pattern b
- preplace :: (Time, Time) -> Pattern String -> Pattern b -> Pattern b
- prep :: (Time, Time) -> Pattern String -> Pattern b -> Pattern b
- preplace1 :: Pattern String -> Pattern b -> Pattern b
- preplaceWith :: (a -> b -> c) -> (Time, Time) -> Pattern a -> Pattern b -> Pattern c
- prw :: (a -> b -> c) -> (Time, Time) -> Pattern a -> Pattern b -> Pattern c
- preplaceWith1 :: (a -> b -> c) -> Pattern a -> Pattern b -> Pattern c
- prw1 :: (a -> b -> c) -> Pattern a -> Pattern b -> Pattern c
- (<~>) :: Pattern String -> Pattern b -> Pattern b
- protate :: Time -> Int -> Pattern a -> Pattern a
- prot :: Time -> Int -> Pattern a -> Pattern a
- prot1 :: Int -> Pattern a -> Pattern a
- (<<~) :: Int -> Pattern a -> Pattern a
- (~>>) :: Int -> Pattern a -> Pattern a
- pequal :: Ord a => Time -> Pattern a -> Pattern a -> Bool
- discretise :: Time -> Pattern a -> Pattern a
- discretise' :: Pattern Time -> Pattern a -> Pattern a
- _discretise :: Time -> Pattern a -> Pattern a
- randcat :: [Pattern a] -> Pattern a
- fit :: Int -> [a] -> Pattern Int -> Pattern a
- permstep :: RealFrac b => Int -> [a] -> Pattern b -> Pattern a
- struct :: Pattern String -> Pattern a -> Pattern a
- substruct :: Pattern String -> Pattern b -> Pattern b
- compressTo :: Arc -> Pattern a -> Pattern a
- randArcs :: Int -> Pattern [Arc]
- randStruct :: Int -> Pattern Int
- substruct' :: Pattern Int -> Pattern a -> Pattern a
- stripe :: Pattern Int -> Pattern a -> Pattern a
- _stripe :: Int -> Pattern a -> Pattern a
- slowstripe :: Pattern Int -> Pattern a -> Pattern a
- parseLMRule :: String -> [(String, String)]
- parseLMRule' :: String -> [(Char, String)]
- lindenmayer :: Int -> String -> String -> String
- lindenmayerI :: Num b => Int -> String -> String -> [b]
- unwrap' :: Pattern (Pattern a) -> Pattern a
- mask :: Pattern a -> Pattern b -> Pattern b
- enclosingArc :: [Arc] -> Arc
- stretch :: Pattern a -> Pattern a
- fit' :: Pattern Time -> Int -> Pattern Int -> Pattern Int -> Pattern a -> Pattern a
- chunk :: Integer -> (Pattern b -> Pattern b) -> Pattern b -> Pattern b
- runWith :: Integer -> (Pattern b -> Pattern b) -> Pattern b -> Pattern b
- chunk' :: Integral a => a -> (Pattern b -> Pattern b) -> Pattern b -> Pattern b
- runWith' :: Integral a => a -> (Pattern b -> Pattern b) -> Pattern b -> Pattern b
- inside :: Pattern Time -> (Pattern a1 -> Pattern a) -> Pattern a1 -> Pattern a
- outside :: Pattern Time -> (Pattern a1 -> Pattern a) -> Pattern a1 -> Pattern a
- loopFirst :: Pattern a -> Pattern a
- timeLoop :: Pattern Time -> Pattern a -> Pattern a
- seqPLoop :: [(Time, Time, Pattern a)] -> Pattern a
- toScale' :: Num a => Int -> [a] -> Pattern Int -> Pattern a
- toScale :: Num a => [a] -> Pattern Int -> Pattern a
- swingBy :: Pattern Time -> Pattern Time -> Pattern a -> Pattern a
- swing :: Pattern Time -> Pattern a -> Pattern a
- cycleChoose :: [a] -> Pattern a
- shuffle :: Int -> Pattern a -> Pattern a
- scramble :: Int -> Pattern a -> Pattern a
- ur :: Time -> Pattern String -> [(String, Pattern a)] -> [(String, Pattern a -> Pattern a)] -> Pattern a
- inhabit :: [(String, Pattern a)] -> Pattern String -> Pattern a
- repeatCycles :: Int -> Pattern a -> Pattern a
- spaceOut :: [Time] -> Pattern a -> Pattern a
- flatpat :: Pattern [a] -> Pattern a
- layer :: [a -> Pattern b] -> a -> Pattern b
- breakUp :: Pattern a -> Pattern a
- fill :: Pattern a -> Pattern a -> Pattern a
- ply :: Pattern Int -> Pattern a -> Pattern a
- _ply :: Int -> Pattern a -> Pattern a
- sew :: Pattern Bool -> Pattern a -> Pattern a -> Pattern a
- scaleP :: Num a => Pattern String -> Pattern Int -> Pattern a
- data Sign
- type ColourD = Colour Double
- class Enumerable a where
- class Parseable a where
- data TPat a
- = TPat_Atom a
- | TPat_Density (TPat Time) (TPat a)
- | TPat_Slow (TPat Time) (TPat a)
- | TPat_Zoom Arc (TPat a)
- | TPat_DegradeBy Double (TPat a)
- | TPat_Silence
- | TPat_Foot
- | TPat_Elongate Int
- | TPat_EnumFromTo (TPat a) (TPat a)
- | TPat_Cat [TPat a]
- | TPat_TimeCat [TPat a]
- | TPat_Overlay (TPat a) (TPat a)
- | TPat_ShiftL Time (TPat a)
- | TPat_pE (TPat Int) (TPat Int) (TPat Integer) (TPat a)
- toPat :: Enumerable a => TPat a -> Pattern a
- durations :: [TPat a] -> [(Int, TPat a)]
- p :: (Enumerable a, Parseable a) => String -> Pattern a
- enumFromTo' :: (Ord a, Enum a) => a -> a -> Pattern a
- enumFromThenTo' :: (Ord a, Enum a, Num a) => a -> a -> a -> Pattern a
- lexer :: GenTokenParser String u Identity
- braces :: Parser a -> Parser a
- brackets :: Parser a -> Parser a
- parens :: Parser a -> Parser a
- angles :: Parser a -> Parser a
- symbol :: String -> Parser String
- natural :: Parser Integer
- integer :: Parser Integer
- float :: Parser Double
- naturalOrFloat :: Parser (Either Integer Double)
- applySign :: Num a => Sign -> a -> a
- sign :: Parser Sign
- intOrFloat :: Parser Double
- r :: (Enumerable a, Parseable a) => String -> Pattern a -> IO (Pattern a)
- parseRhythm :: Parseable a => Parser (TPat a) -> String -> TPat a
- pSequenceN :: Parseable a => Parser (TPat a) -> GenParser Char () (Int, TPat a)
- elongate :: [TPat a] -> TPat a
- splitFeet :: [TPat t] -> [[TPat t]]
- pSequence :: Parseable a => Parser (TPat a) -> GenParser Char () (TPat a)
- pSingle :: Parseable a => Parser (TPat a) -> Parser (TPat a)
- pPart :: Parseable a => Parser (TPat a) -> Parser [TPat a]
- pPolyIn :: Parseable a => Parser (TPat a) -> Parser (TPat a)
- pPolyOut :: Parseable a => Parser (TPat a) -> Parser (TPat a)
- pString :: Parser String
- pVocable :: Parser (TPat String)
- pDouble :: Parser (TPat Double)
- pBool :: Parser (TPat Bool)
- parseIntNote :: Integral i => Parser i
- parseInt :: Parser Int
- pIntegral :: Parseable a => Integral a => Parser (TPat a)
- parseNote :: Num a => Parser a
- fromNote :: Num a => Pattern String -> Pattern a
- pColour :: Parser (TPat ColourD)
- pMult :: Parseable a => TPat a -> Parser (TPat a)
- pRand :: Parseable a => TPat a -> Parser (TPat a)
- pE :: Parseable a => TPat a -> Parser (TPat a)
- eoff :: Pattern Int -> Pattern Int -> Pattern Integer -> Pattern a -> Pattern a
- _eoff :: Int -> Int -> Integer -> Pattern a -> Pattern a
- pReplicate :: Parseable a => TPat a -> Parser [TPat a]
- pStretch :: Parseable a => TPat a -> Parser [TPat a]
- pRatio :: Parser Rational
- pRational :: Parser (TPat Rational)
- type ParamPattern = Pattern ParamMap
- type ParamMap = Map Param Value
- class ParamType a where
- data Value
- data Shape = Shape {}
- data Param
- data Backend a = Backend {}
- type ToMessageFunc = Shape -> Tempo -> Int -> (Double, Double, ParamMap) -> Maybe (IO ())
- ticksPerCycle :: Num p => p
- defaultValue :: Param -> Value
- hasDefault :: Param -> Bool
- defaulted :: Shape -> [Param]
- defaultMap :: Shape -> ParamMap
- required :: Shape -> [Param]
- hasRequired :: Shape -> ParamMap -> Bool
- isSubset :: Eq a => [a] -> [a] -> Bool
- doAt :: RealFrac a => a -> IO () -> IO ()
- logicalOnset' :: Integral a => Tempo -> a -> Double -> Double -> Double
- applyShape' :: Shape -> ParamMap -> Maybe ParamMap
- start :: Backend a -> Shape -> IO (MVar ParamPattern)
- state :: Backend a -> Shape -> IO (MVar (ParamPattern, [ParamPattern]))
- stream :: Backend a -> Shape -> IO (ParamPattern -> IO ())
- streamcallback :: (ParamPattern -> IO ()) -> Backend a -> Shape -> IO (ParamPattern -> IO ())
- onTick :: Backend a -> Shape -> MVar ParamPattern -> Tempo -> Int -> IO ()
- onTick' :: Backend a -> Shape -> MVar (ParamPattern, [ParamPattern]) -> Tempo -> Int -> IO ()
- make :: (a -> Value) -> Shape -> String -> Pattern a -> ParamPattern
- make' :: ParamType a => (a -> Value) -> Param -> Pattern a -> ParamPattern
- makeP :: ParamType a => Param -> Pattern a -> ParamPattern
- makeS :: Shape -> String -> Pattern String -> ParamPattern
- makeF :: Shape -> String -> Pattern Double -> ParamPattern
- makeI :: Shape -> String -> Pattern Int -> ParamPattern
- param :: Shape -> String -> Param
- merge :: ParamPattern -> ParamPattern -> ParamPattern
- (|=|) :: ParamPattern -> ParamPattern -> ParamPattern
- (#) :: ParamPattern -> ParamPattern -> ParamPattern
- mergeWith :: (Ord k, Applicative f) => (k -> a -> a -> a) -> f (Map k a) -> f (Map k a) -> f (Map k a)
- mergeNumWith :: Applicative f => (Int -> Int -> Int) -> (Double -> Double -> Double) -> f (Map Param Value) -> f (Map Param Value) -> f (Map Param Value)
- mergePlus :: Applicative f => f (Map Param Value) -> f (Map Param Value) -> f (Map Param Value)
- (|*|) :: ParamPattern -> ParamPattern -> ParamPattern
- (|+|) :: ParamPattern -> ParamPattern -> ParamPattern
- (|-|) :: ParamPattern -> ParamPattern -> ParamPattern
- (|/|) :: ParamPattern -> ParamPattern -> ParamPattern
- (###) :: Foldable t => ParamPattern -> t ParamPattern -> ParamPattern
- (***) :: Foldable t => ParamPattern -> t ParamPattern -> ParamPattern
- (+++) :: Foldable t => ParamPattern -> t ParamPattern -> ParamPattern
- (///) :: Foldable t => ParamPattern -> t ParamPattern -> ParamPattern
- setter :: MVar (a, [a]) -> a -> IO ()
- copyParam :: Param -> Param -> ParamPattern -> ParamPattern
- get :: ParamType a => Param -> ParamPattern -> Pattern a
- getI :: Param -> ParamPattern -> Pattern Int
- getF :: Param -> ParamPattern -> Pattern Double
- getS :: Param -> ParamPattern -> Pattern String
- with :: ParamType a => Param -> (Pattern a -> Pattern a) -> ParamPattern -> ParamPattern
- withI :: Param -> (Pattern Int -> Pattern Int) -> ParamPattern -> ParamPattern
- withF :: Param -> (Pattern Double -> Pattern Double) -> ParamPattern -> ParamPattern
- withS :: Param -> (Pattern String -> Pattern String) -> ParamPattern -> ParamPattern
- follow :: (ParamType a, ParamType b) => Param -> Param -> (Pattern a -> Pattern b) -> ParamPattern -> ParamPattern
- follow' :: ParamType a => Param -> Param -> (Pattern a -> Pattern a) -> ParamPattern -> ParamPattern
- followI :: Param -> Param -> (Pattern Int -> Pattern Int) -> ParamPattern -> ParamPattern
- followF :: Param -> Param -> (Pattern Double -> Pattern Double) -> ParamPattern -> ParamPattern
- followS :: Param -> Param -> (Pattern String -> Pattern String) -> ParamPattern -> ParamPattern
- coerce :: Param -> ParamPattern -> ParamPattern
- chord :: Num a => Pattern String -> Pattern a
- grp :: [Param] -> Pattern String -> ParamPattern
- sound :: Pattern String -> ParamPattern
- s :: Pattern String -> ParamPattern
- pF :: String -> Maybe Double -> (Pattern Double -> ParamPattern, Param)
- pI :: String -> Maybe Int -> (Pattern Int -> ParamPattern, Param)
- pS :: String -> Maybe String -> (Pattern String -> ParamPattern, Param)
- accelerate :: Pattern Double -> ParamPattern
- accelerate_p :: Param
- attack :: Pattern Double -> ParamPattern
- attack_p :: Param
- bandf :: Pattern Double -> ParamPattern
- bandf_p :: Param
- bandq :: Pattern Double -> ParamPattern
- bandq_p :: Param
- begin :: Pattern Double -> ParamPattern
- begin_p :: Param
- channel :: Pattern Int -> ParamPattern
- channel_p :: Param
- legato :: Pattern Double -> ParamPattern
- legato_p :: Param
- clhatdecay :: Pattern Double -> ParamPattern
- clhatdecay_p :: Param
- coarse :: Pattern Int -> ParamPattern
- coarse_p :: Param
- crush :: Pattern Double -> ParamPattern
- crush_p :: Param
- cut :: Pattern Int -> ParamPattern
- cut_p :: Param
- cutoff :: Pattern Double -> ParamPattern
- cutoff_p :: Param
- cutoffegint :: Pattern Double -> ParamPattern
- cutoffegint_p :: Param
- decay :: Pattern Double -> ParamPattern
- decay_p :: Param
- delay :: Pattern Double -> ParamPattern
- delay_p :: Param
- delayfeedback :: Pattern Double -> ParamPattern
- delayfeedback_p :: Param
- delaytime :: Pattern Double -> ParamPattern
- delaytime_p :: Param
- detune :: Pattern Double -> ParamPattern
- detune_p :: Param
- dry :: Pattern Double -> ParamPattern
- dry_p :: Param
- end :: Pattern Double -> ParamPattern
- end_p :: Param
- gain :: Pattern Double -> ParamPattern
- gain_p :: Param
- gate :: Pattern Double -> ParamPattern
- gate_p :: Param
- hatgrain :: Pattern Double -> ParamPattern
- hatgrain_p :: Param
- hcutoff :: Pattern Double -> ParamPattern
- hcutoff_p :: Param
- hold :: Pattern Double -> ParamPattern
- hold_p :: Param
- hresonance :: Pattern Double -> ParamPattern
- hresonance_p :: Param
- kriole :: Pattern Int -> ParamPattern
- kriole_p :: Param
- lagogo :: Pattern Double -> ParamPattern
- lagogo_p :: Param
- lclap :: Pattern Double -> ParamPattern
- lclap_p :: Param
- lclaves :: Pattern Double -> ParamPattern
- lclaves_p :: Param
- lclhat :: Pattern Double -> ParamPattern
- lclhat_p :: Param
- lcrash :: Pattern Double -> ParamPattern
- lcrash_p :: Param
- leslie :: Pattern Double -> ParamPattern
- leslie_p :: Param
- lrate :: Pattern Double -> ParamPattern
- lrate_p :: Param
- lsize :: Pattern Double -> ParamPattern
- lsize_p :: Param
- lfo :: Pattern Double -> ParamPattern
- lfo_p :: Param
- lfocutoffint :: Pattern Double -> ParamPattern
- lfocutoffint_p :: Param
- lfodelay :: Pattern Double -> ParamPattern
- lfodelay_p :: Param
- lfoint :: Pattern Double -> ParamPattern
- lfoint_p :: Param
- lfopitchint :: Pattern Double -> ParamPattern
- lfopitchint_p :: Param
- lfoshape :: Pattern Double -> ParamPattern
- lfoshape_p :: Param
- lfosync :: Pattern Double -> ParamPattern
- lfosync_p :: Param
- lhitom :: Pattern Double -> ParamPattern
- lhitom_p :: Param
- lkick :: Pattern Double -> ParamPattern
- lkick_p :: Param
- llotom :: Pattern Double -> ParamPattern
- llotom_p :: Param
- lock :: Pattern Double -> ParamPattern
- lock_p :: Param
- loop :: Pattern Double -> ParamPattern
- loop_p :: Param
- lophat :: Pattern Double -> ParamPattern
- lophat_p :: Param
- lsnare :: Pattern Double -> ParamPattern
- lsnare_p :: Param
- n :: Pattern Double -> ParamPattern
- n_p :: Param
- note :: Pattern Double -> ParamPattern
- note_p :: Param
- degree :: Pattern Double -> ParamPattern
- degree_p :: Param
- mtranspose :: Pattern Double -> ParamPattern
- mtranspose_p :: Param
- ctranspose :: Pattern Double -> ParamPattern
- ctranspose_p :: Param
- harmonic :: Pattern Double -> ParamPattern
- harmonic_p :: Param
- stepsPerOctave :: Pattern Double -> ParamPattern
- stepsPerOctave_p :: Param
- octaveRatio :: Pattern Double -> ParamPattern
- octaveRatio_p :: Param
- nudge :: Pattern Double -> ParamPattern
- nudge_p :: Param
- octave :: Pattern Int -> ParamPattern
- octave_p :: Param
- offset :: Pattern Double -> ParamPattern
- offset_p :: Param
- ophatdecay :: Pattern Double -> ParamPattern
- ophatdecay_p :: Param
- orbit :: Pattern Int -> ParamPattern
- orbit_p :: Param
- pan :: Pattern Double -> ParamPattern
- pan_p :: Param
- panspan :: Pattern Double -> ParamPattern
- panspan_p :: Param
- pansplay :: Pattern Double -> ParamPattern
- pansplay_p :: Param
- panwidth :: Pattern Double -> ParamPattern
- panwidth_p :: Param
- panorient :: Pattern Double -> ParamPattern
- panorient_p :: Param
- pitch1 :: Pattern Double -> ParamPattern
- pitch1_p :: Param
- pitch2 :: Pattern Double -> ParamPattern
- pitch2_p :: Param
- pitch3 :: Pattern Double -> ParamPattern
- pitch3_p :: Param
- portamento :: Pattern Double -> ParamPattern
- portamento_p :: Param
- release :: Pattern Double -> ParamPattern
- release_p :: Param
- resonance :: Pattern Double -> ParamPattern
- resonance_p :: Param
- room :: Pattern Double -> ParamPattern
- room_p :: Param
- sagogo :: Pattern Double -> ParamPattern
- sagogo_p :: Param
- sclap :: Pattern Double -> ParamPattern
- sclap_p :: Param
- sclaves :: Pattern Double -> ParamPattern
- sclaves_p :: Param
- scrash :: Pattern Double -> ParamPattern
- scrash_p :: Param
- semitone :: Pattern Double -> ParamPattern
- semitone_p :: Param
- shape :: Pattern Double -> ParamPattern
- shape_p :: Param
- size :: Pattern Double -> ParamPattern
- size_p :: Param
- slide :: Pattern Double -> ParamPattern
- slide_p :: Param
- speed :: Pattern Double -> ParamPattern
- speed_p :: Param
- s' :: Pattern String -> ParamPattern
- s_p :: Param
- stutterdepth :: Pattern Double -> ParamPattern
- stutterdepth_p :: Param
- stuttertime :: Pattern Double -> ParamPattern
- stuttertime_p :: Param
- sustain :: Pattern Double -> ParamPattern
- sustain_p :: Param
- tomdecay :: Pattern Double -> ParamPattern
- tomdecay_p :: Param
- unit :: Pattern String -> ParamPattern
- unit_p :: Param
- velocity :: Pattern Double -> ParamPattern
- velocity_p :: Param
- vcfegint :: Pattern Double -> ParamPattern
- vcfegint_p :: Param
- vcoegint :: Pattern Double -> ParamPattern
- vcoegint_p :: Param
- voice :: Pattern Double -> ParamPattern
- voice_p :: Param
- vowel :: Pattern String -> ParamPattern
- vowel_p :: Param
- dur :: Pattern Double -> ParamPattern
- dur_p :: Param
- modwheel :: Pattern Double -> ParamPattern
- modwheel_p :: Param
- expression :: Pattern Double -> ParamPattern
- expression_p :: Param
- sustainpedal :: Pattern Double -> ParamPattern
- sustainpedal_p :: Param
- tremolorate :: Pattern Double -> ParamPattern
- tremolorate_p :: Param
- tremolodepth :: Pattern Double -> ParamPattern
- tremolodepth_p :: Param
- phaserrate :: Pattern Double -> ParamPattern
- phaserrate_p :: Param
- phaserdepth :: Pattern Double -> ParamPattern
- phaserdepth_p :: Param
- att :: Pattern Double -> ParamPattern
- bpf :: Pattern Double -> ParamPattern
- bpf_p :: Param
- bpq :: Pattern Double -> ParamPattern
- bpq_p :: Param
- chdecay :: Pattern Double -> ParamPattern
- ctf :: Pattern Double -> ParamPattern
- ctfg :: Pattern Double -> ParamPattern
- delayfb :: Pattern Double -> ParamPattern
- delayt :: Pattern Double -> ParamPattern
- det :: Pattern Double -> ParamPattern
- gat :: Pattern Double -> ParamPattern
- hg :: Pattern Double -> ParamPattern
- hpf :: Pattern Double -> ParamPattern
- hpf_p :: Param
- hpq :: Pattern Double -> ParamPattern
- hpq_p :: Param
- lag :: Pattern Double -> ParamPattern
- lbd :: Pattern Double -> ParamPattern
- lch :: Pattern Double -> ParamPattern
- lcl :: Pattern Double -> ParamPattern
- lcp :: Pattern Double -> ParamPattern
- lcr :: Pattern Double -> ParamPattern
- lfoc :: Pattern Double -> ParamPattern
- lfoi :: Pattern Double -> ParamPattern
- lfop :: Pattern Double -> ParamPattern
- lht :: Pattern Double -> ParamPattern
- llt :: Pattern Double -> ParamPattern
- loh :: Pattern Double -> ParamPattern
- lpf :: Pattern Double -> ParamPattern
- lpf_p :: Param
- lpq :: Pattern Double -> ParamPattern
- lpq_p :: Param
- lsn :: Pattern Double -> ParamPattern
- ohdecay :: Pattern Double -> ParamPattern
- phasdp :: Pattern Double -> ParamPattern
- phasr :: Pattern Double -> ParamPattern
- pit1 :: Pattern Double -> ParamPattern
- pit2 :: Pattern Double -> ParamPattern
- pit3 :: Pattern Double -> ParamPattern
- por :: Pattern Double -> ParamPattern
- rel :: Pattern Double -> ParamPattern
- sag :: Pattern Double -> ParamPattern
- scl :: Pattern Double -> ParamPattern
- scp :: Pattern Double -> ParamPattern
- scr :: Pattern Double -> ParamPattern
- sz :: Pattern Double -> ParamPattern
- sld :: Pattern Double -> ParamPattern
- std :: Pattern Double -> ParamPattern
- stt :: Pattern Double -> ParamPattern
- sus :: Pattern Double -> ParamPattern
- tdecay :: Pattern Double -> ParamPattern
- tremdp :: Pattern Double -> ParamPattern
- tremr :: Pattern Double -> ParamPattern
- vcf :: Pattern Double -> ParamPattern
- vco :: Pattern Double -> ParamPattern
- voi :: Pattern Double -> ParamPattern
- midinote :: Pattern Double -> ParamPattern
- drum :: Pattern String -> ParamPattern
- drumN :: Num a => String -> a
- array :: Pattern Double -> ParamPattern
- array_p :: Param
- midichan :: Pattern Double -> ParamPattern
- midichan_p :: Param
- control :: Pattern Double -> ParamPattern
- control_p :: Param
- ccn :: Pattern Double -> ParamPattern
- ccn_p :: Param
- ccv :: Pattern Double -> ParamPattern
- ccv_p :: Param
- cc :: Pattern String -> ParamPattern
- ctlNum :: Pattern Double -> ParamPattern
- ctlNum_p :: Param
- frameRate :: Pattern Double -> ParamPattern
- frameRate_p :: Param
- frames :: Pattern Double -> ParamPattern
- frames_p :: Param
- hours :: Pattern Double -> ParamPattern
- hours_p :: Param
- midicmd :: Pattern String -> ParamPattern
- midicmd_p :: Param
- command :: Pattern String -> ParamPattern
- minutes :: Pattern Double -> ParamPattern
- minutes_p :: Param
- progNum :: Pattern Double -> ParamPattern
- progNum_p :: Param
- seconds :: Pattern Double -> ParamPattern
- seconds_p :: Param
- songPtr :: Pattern Double -> ParamPattern
- songPtr_p :: Param
- uid :: Pattern Double -> ParamPattern
- uid_p :: Param
- val :: Pattern Double -> ParamPattern
- val_p :: Param
- transition :: IO Time -> MVar (ParamPattern, [ParamPattern]) -> (Time -> [ParamPattern] -> ParamPattern) -> ParamPattern -> IO ()
- histpan :: Int -> Time -> [ParamPattern] -> ParamPattern
- superwash :: (Pattern a -> Pattern a) -> (Pattern a -> Pattern a) -> Time -> Time -> Time -> Time -> [Pattern a] -> Pattern a
- wash :: (Pattern a -> Pattern a) -> Time -> Time -> [Pattern a] -> Pattern a
- wait :: Time -> Time -> [ParamPattern] -> ParamPattern
- wait' :: (Time -> [ParamPattern] -> ParamPattern) -> Time -> Time -> [ParamPattern] -> ParamPattern
- jump :: Time -> [ParamPattern] -> ParamPattern
- jumpIn :: Int -> Time -> [ParamPattern] -> ParamPattern
- jumpIn' :: Int -> Time -> [ParamPattern] -> ParamPattern
- jumpMod :: Int -> Time -> [ParamPattern] -> ParamPattern
- mortal :: Time -> Time -> Time -> [ParamPattern] -> ParamPattern
- combineV :: (Value -> Value -> Value) -> ParamMap -> ParamMap -> ParamMap
- mixNums :: Double -> Value -> Value -> Value
- interpolateIn :: Time -> Time -> [ParamPattern] -> ParamPattern
- supercollider :: [Param] -> Double -> Shape
- scSlang :: String -> OscSlang
- scBackend :: String -> IO (Backend a)
- scStream :: String -> [Param] -> Double -> IO (ParamPattern -> IO (), Shape)
- dirt :: Shape
- dirtSlang :: OscSlang
- superDirtSlang :: OscSlang
- superDirtBackend :: Int -> IO (Backend a)
- superDirtState :: Int -> IO (MVar (ParamPattern, [ParamPattern]))
- dirtBackend :: IO (Backend a)
- dirtStream :: IO (ParamPattern -> IO ())
- dirtState :: IO (MVar (ParamPattern, [ParamPattern]))
- dirtSetters :: IO Time -> IO (ParamPattern -> IO (), (Time -> [ParamPattern] -> ParamPattern) -> ParamPattern -> IO ())
- superDirtSetters :: IO Time -> IO (ParamPattern -> IO (), (Time -> [ParamPattern] -> ParamPattern) -> ParamPattern -> IO ())
- superDirts :: [Int] -> IO [(ParamPattern -> IO (), (Time -> [ParamPattern] -> ParamPattern) -> ParamPattern -> IO ())]
- dirtstream :: p -> IO (ParamPattern -> IO ())
- dirtToColour :: ParamPattern -> Pattern ColourD
- showToColour :: Show a => a -> ColourD
- datumToColour :: Value -> ColourD
- stringToColour :: String -> ColourD
- pick :: String -> Int -> String
- striate :: Pattern Int -> ParamPattern -> ParamPattern
- _striate :: Int -> ParamPattern -> ParamPattern
- striate' :: Pattern Int -> Pattern Double -> ParamPattern -> ParamPattern
- _striate' :: Int -> Double -> ParamPattern -> ParamPattern
- striateO :: Pattern Int -> Pattern Double -> ParamPattern -> ParamPattern
- _striateO :: Int -> Double -> ParamPattern -> ParamPattern
- striateL :: Pattern Int -> Pattern Int -> ParamPattern -> ParamPattern
- striateL' :: Pattern Int -> Pattern Double -> Pattern Int -> ParamPattern -> ParamPattern
- _striateL :: Int -> Int -> ParamPattern -> ParamPattern
- _striateL' :: Integral a => Int -> Double -> a -> ParamPattern -> ParamPattern
- metronome :: Pattern ParamMap
- clutchIn :: Time -> Time -> [Pattern a] -> Pattern a
- clutch :: Time -> [Pattern a] -> Pattern a
- xfadeIn :: Time -> Time -> [ParamPattern] -> ParamPattern
- xfade :: Time -> [ParamPattern] -> ParamPattern
- stut :: Pattern Integer -> Pattern Double -> Pattern Rational -> ParamPattern -> ParamPattern
- _stut :: Integer -> Double -> Rational -> ParamPattern -> ParamPattern
- stut' :: Pattern Int -> Pattern Time -> (Pattern a -> Pattern a) -> Pattern a -> Pattern a
- _stut' :: (Num n, Ord n) => n -> Time -> (Pattern a -> Pattern a) -> Pattern a -> Pattern a
- durPattern :: Pattern a -> Pattern Time
- durPattern' :: Pattern a -> Pattern Time
- stutx :: Pattern Int -> Pattern Time -> (Pattern a -> Pattern a) -> Pattern a -> Pattern a
- anticipateIn :: Time -> Time -> [ParamPattern] -> ParamPattern
- anticipate :: Time -> [ParamPattern] -> ParamPattern
- nToOrbit :: ParamPattern -> ParamPattern
- soundToOrbit :: [String] -> ParamPattern -> ParamPattern
- stutter :: Integral i => i -> Time -> Pattern a -> Pattern a
- echo :: Time -> Pattern a -> Pattern a
- triple :: Time -> Pattern a -> Pattern a
- quad :: Time -> Pattern a -> Pattern a
- double :: Time -> Pattern a -> Pattern a
- jux :: (ParamPattern -> Pattern ParamMap) -> ParamPattern -> Pattern ParamMap
- juxcut :: (ParamPattern -> Pattern ParamMap) -> ParamPattern -> Pattern ParamMap
- juxcut' :: [t -> ParamPattern] -> t -> Pattern ParamMap
- jux' :: [t -> ParamPattern] -> t -> Pattern ParamMap
- jux4 :: (ParamPattern -> Pattern ParamMap) -> ParamPattern -> Pattern ParamMap
- juxBy :: Pattern Double -> (ParamPattern -> Pattern ParamMap) -> ParamPattern -> Pattern ParamMap
- smash :: Pattern Int -> [Pattern Time] -> ParamPattern -> Pattern ParamMap
- smash' :: Int -> [Pattern Time] -> ParamPattern -> Pattern ParamMap
- samples :: Applicative f => f String -> f Int -> f String
- samples' :: Applicative f => f String -> f Int -> f String
- spreadf :: p1 -> p2 -> [a -> Pattern b] -> a -> Pattern b
- spin :: Pattern Int -> ParamPattern -> ParamPattern
- _spin :: Int -> ParamPattern -> ParamPattern
- sawwave4 :: Pattern Double
- sinewave4 :: Pattern Double
- rand4 :: Pattern Double
- stackwith :: Pattern ParamMap -> [ParamPattern] -> Pattern ParamMap
- scale :: (Functor f, Num b) => b -> b -> f b -> f b
- scalex :: (Functor f, Floating b) => b -> b -> f b -> f b
- chop :: Pattern Int -> ParamPattern -> ParamPattern
- _chop :: Int -> ParamPattern -> ParamPattern
- gap :: Pattern Int -> ParamPattern -> ParamPattern
- _gap :: Int -> ParamPattern -> ParamPattern
- chopArc :: Arc -> Int -> [Arc]
- en :: [(Int, Int)] -> Pattern String -> Pattern String
- weave :: Rational -> ParamPattern -> [ParamPattern] -> ParamPattern
- weave' :: Rational -> Pattern a -> [Pattern a -> Pattern a] -> Pattern a
- interlace :: ParamPattern -> ParamPattern -> ParamPattern
- step :: String -> String -> Pattern String
- steps :: [(String, String)] -> Pattern String
- step' :: [String] -> String -> Pattern String
- off :: Pattern Time -> (Pattern a -> Pattern a) -> Pattern a -> Pattern a
- _off :: Time -> (Pattern a -> Pattern a) -> Pattern a -> Pattern a
- offadd :: Num a => Pattern Time -> Pattern a -> Pattern a -> Pattern a
- up :: Pattern Double -> ParamPattern
- ghost'' :: Time -> (Pattern a -> Pattern a) -> Pattern a -> Pattern a
- ghost' :: p -> Pattern ParamMap -> Pattern ParamMap
- ghost :: Pattern ParamMap -> Pattern ParamMap
- slice :: Pattern Int -> Pattern Int -> ParamPattern -> ParamPattern
- _slice :: Int -> Int -> ParamPattern -> ParamPattern
- randslice :: Int -> ParamPattern -> ParamPattern
- loopAt :: Pattern Time -> ParamPattern -> ParamPattern
- tabby :: Integer -> Pattern a -> Pattern a -> Pattern a
- hurry :: Pattern Rational -> ParamPattern -> ParamPattern
- data Sieve a = Sieve {}
- (@@) :: Int -> Int -> Sieve Bool
- not' :: Applicative f => f Bool -> f Bool
- (#||#) :: Applicative f => f Bool -> f Bool -> f Bool
- (#&&#) :: Applicative f => f Bool -> f Bool -> f Bool
- (#^^#) :: Applicative f => f Bool -> f Bool -> f Bool
- sieveToList :: Int -> Sieve a -> [a]
- sieveToString :: Int -> Sieve Bool -> [Char]
- sieveToInts :: Int -> Sieve Bool -> [Int]
- sieveToPat :: Int -> Sieve Bool -> Pattern String
- stepSieve :: Int -> String -> Sieve Bool -> Pattern String
- slowstepSieve :: Pattern Time -> Int -> String -> Sieve Bool -> Pattern String
- scaleSieve :: Int -> Sieve Bool -> Pattern Int -> Pattern Int
- parseEspTempo :: [Datum] -> Maybe Tempo
- changeTempo :: MVar Tempo -> Packet -> IO ()
- getTempo :: MVar Tempo -> IO Tempo
- runClientEsp :: IO (MVar Tempo, MVar Double)
- sendEspTempo :: Real t => t -> IO ()
- cpsUtilsEsp :: IO (Double -> IO (), IO Rational, IO Tempo)
- clockedTickEsp :: Int -> (Tempo -> Int -> IO ()) -> IO ()
- clockedTickLoopEsp :: Int -> (Tempo -> Int -> IO ()) -> MVar Tempo -> Int -> IO Int
- streamEsp :: Backend a -> Shape -> IO (ParamPattern -> IO ())
- dirtStreamEsp :: IO (ParamPattern -> IO ())
- stateEsp :: Backend a -> Shape -> IO (MVar (ParamPattern, [ParamPattern]))
- dirtSettersEsp :: IO Time -> IO (ParamPattern -> IO (), (Time -> [ParamPattern] -> ParamPattern) -> ParamPattern -> IO ())
- superDirtSettersEsp :: IO Time -> IO (ParamPattern -> IO (), (Time -> [ParamPattern] -> ParamPattern) -> ParamPattern -> IO ())
- type CpsUtils = (Double -> IO (), IO Rational)
- data SyncType
- data StreamType
- initializeStreamType :: IO (MVar StreamType)
- changeStreamType :: MVar StreamType -> StreamType -> IO (IO StreamType)
- initializeSyncType :: IO (MVar SyncType)
- changeSyncType :: MVar SyncType -> SyncType -> IO (IO SyncType)
- multiModeCpsUtils :: CpsUtils -> CpsUtils -> MVar SyncType -> IO CpsUtils
- multiModeSetters :: IO Rational -> IO Rational -> MVar SyncType -> MVar StreamType -> IO (ParamPattern -> IO ())
- tidal_version :: [Char]
Documentation
(++) :: [a] -> [a] -> [a] infixr 5 #
Append two lists, i.e.,
[x1, ..., xm] ++ [y1, ..., yn] == [x1, ..., xm, y1, ..., yn] [x1, ..., xm] ++ [y1, ...] == [x1, ..., xm, y1, ...]
If the first list is not finite, the result is the first list.
filter :: (a -> Bool) -> [a] -> [a] #
filter
, applied to a predicate and a list, returns the list of
those elements that satisfy the predicate; i.e.,
filter p xs = [ x | x <- xs, p x]
map :: (a -> b) -> [a] -> [b] #
map
f xs
is the list obtained by applying f
to each element
of xs
, i.e.,
map f [x1, x2, ..., xn] == [f x1, f x2, ..., f xn] map f [x1, x2, ...] == [f x1, f x2, ...]
class Functor f => Applicative (f :: * -> *) where #
A functor with application, providing operations to
A minimal complete definition must include implementations of pure
and of either <*>
or liftA2
. If it defines both, then they must behave
the same as their default definitions:
(<*>
) =liftA2
id
liftA2
f x y = f<$>
x<*>
y
Further, any definition must satisfy the following:
- identity
pure
id
<*>
v = v- composition
pure
(.)<*>
u<*>
v<*>
w = u<*>
(v<*>
w)- homomorphism
pure
f<*>
pure
x =pure
(f x)- interchange
u
<*>
pure
y =pure
($
y)<*>
u
The other methods have the following default definitions, which may be overridden with equivalent specialized implementations:
As a consequence of these laws, the Functor
instance for f
will satisfy
It may be useful to note that supposing
forall x y. p (q x y) = f x . g y
it follows from the above that
liftA2
p (liftA2
q u v) =liftA2
f u .liftA2
g v
If f
is also a Monad
, it should satisfy
(which implies that pure
and <*>
satisfy the applicative functor laws).
Lift a value.
(<*>) :: f (a -> b) -> f a -> f b infixl 4 #
Sequential application.
A few functors support an implementation of <*>
that is more
efficient than the default one.
liftA2 :: (a -> b -> c) -> f a -> f b -> f c #
Lift a binary function to actions.
Some functors support an implementation of liftA2
that is more
efficient than the default one. In particular, if fmap
is an
expensive operation, it is likely better to use liftA2
than to
fmap
over the structure and then use <*>
.
(*>) :: f a -> f b -> f b infixl 4 #
Sequence actions, discarding the value of the first argument.
(<*) :: f a -> f b -> f a infixl 4 #
Sequence actions, discarding the value of the second argument.
Instances
Applicative [] | Since: base-2.1 |
Applicative Maybe | Since: base-2.1 |
Applicative IO | Since: base-2.1 |
Applicative Par1 | Since: base-4.9.0.0 |
Applicative Min | Since: base-4.9.0.0 |
Applicative Max | Since: base-4.9.0.0 |
Applicative First | Since: base-4.9.0.0 |
Applicative Last | Since: base-4.9.0.0 |
Applicative Option | Since: base-4.9.0.0 |
Applicative ZipList | f '<$>' 'ZipList' xs1 '<*>' ... '<*>' 'ZipList' xsN = 'ZipList' (zipWithN f xs1 ... xsN) where (\a b c -> stimes c [a, b]) <$> ZipList "abcd" <*> ZipList "567" <*> ZipList [1..] = ZipList (zipWith3 (\a b c -> stimes c [a, b]) "abcd" "567" [1..]) = ZipList {getZipList = ["a5","b6b6","c7c7c7"]} Since: base-2.1 |
Applicative Identity | Since: base-4.8.0.0 |
Applicative STM | Since: base-4.8.0.0 |
Applicative First | |
Applicative Last | |
Applicative Dual | Since: base-4.8.0.0 |
Applicative Sum | Since: base-4.8.0.0 |
Applicative Product | Since: base-4.8.0.0 |
Applicative Down | Since: base-4.11.0.0 |
Applicative ReadP | Since: base-4.6.0.0 |
Applicative NonEmpty | Since: base-4.9.0.0 |
Applicative RGB | |
Applicative P | Since: base-4.5.0.0 |
Applicative Pattern # |
|
Applicative Sieve # | |
Applicative (Either e) | Since: base-3.0 |
Applicative (U1 :: * -> *) | Since: base-4.9.0.0 |
Monoid a => Applicative ((,) a) | For tuples, the ("hello ", (+15)) <*> ("world!", 2002) ("hello world!",2017) Since: base-2.1 |
Monad m => Applicative (WrappedMonad m) | Since: base-2.1 |
Defined in Control.Applicative pure :: a -> WrappedMonad m a # (<*>) :: WrappedMonad m (a -> b) -> WrappedMonad m a -> WrappedMonad m b # liftA2 :: (a -> b -> c) -> WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m c # (*>) :: WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m b # (<*) :: WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m a # | |
Arrow a => Applicative (ArrowMonad a) | Since: base-4.6.0.0 |
Defined in Control.Arrow pure :: a0 -> ArrowMonad a a0 # (<*>) :: ArrowMonad a (a0 -> b) -> ArrowMonad a a0 -> ArrowMonad a b # liftA2 :: (a0 -> b -> c) -> ArrowMonad a a0 -> ArrowMonad a b -> ArrowMonad a c # (*>) :: ArrowMonad a a0 -> ArrowMonad a b -> ArrowMonad a b # (<*) :: ArrowMonad a a0 -> ArrowMonad a b -> ArrowMonad a a0 # | |
Applicative (Proxy :: * -> *) | Since: base-4.7.0.0 |
Applicative f => Applicative (Rec1 f) | Since: base-4.9.0.0 |
Arrow a => Applicative (WrappedArrow a b) | Since: base-2.1 |
Defined in Control.Applicative pure :: a0 -> WrappedArrow a b a0 # (<*>) :: WrappedArrow a b (a0 -> b0) -> WrappedArrow a b a0 -> WrappedArrow a b b0 # liftA2 :: (a0 -> b0 -> c) -> WrappedArrow a b a0 -> WrappedArrow a b b0 -> WrappedArrow a b c # (*>) :: WrappedArrow a b a0 -> WrappedArrow a b b0 -> WrappedArrow a b b0 # (<*) :: WrappedArrow a b a0 -> WrappedArrow a b b0 -> WrappedArrow a b a0 # | |
Monoid m => Applicative (Const m :: * -> *) | Since: base-2.0.1 |
Applicative f => Applicative (Alt f) | |
(Functor m, Monad m) => Applicative (ErrorT e m) | |
Defined in Control.Monad.Trans.Error | |
Applicative ((->) a :: * -> *) | Since: base-2.1 |
(Applicative f, Applicative g) => Applicative (f :*: g) | Since: base-4.9.0.0 |
(Applicative f, Monad f) => Applicative (WhenMissing f k x) | Equivalent to Since: containers-0.5.9 |
Defined in Data.Map.Internal pure :: a -> WhenMissing f k x a # (<*>) :: WhenMissing f k x (a -> b) -> WhenMissing f k x a -> WhenMissing f k x b # liftA2 :: (a -> b -> c) -> WhenMissing f k x a -> WhenMissing f k x b -> WhenMissing f k x c # (*>) :: WhenMissing f k x a -> WhenMissing f k x b -> WhenMissing f k x b # (<*) :: WhenMissing f k x a -> WhenMissing f k x b -> WhenMissing f k x a # | |
Applicative (ParsecT s u m) | |
Defined in Text.Parsec.Prim pure :: a -> ParsecT s u m a # (<*>) :: ParsecT s u m (a -> b) -> ParsecT s u m a -> ParsecT s u m b # liftA2 :: (a -> b -> c) -> ParsecT s u m a -> ParsecT s u m b -> ParsecT s u m c # (*>) :: ParsecT s u m a -> ParsecT s u m b -> ParsecT s u m b # (<*) :: ParsecT s u m a -> ParsecT s u m b -> ParsecT s u m a # | |
Applicative f => Applicative (M1 i c f) | Since: base-4.9.0.0 |
(Applicative f, Applicative g) => Applicative (f :.: g) | Since: base-4.9.0.0 |
(Monad f, Applicative f) => Applicative (WhenMatched f k x y) | Equivalent to Since: containers-0.5.9 |
Defined in Data.Map.Internal pure :: a -> WhenMatched f k x y a # (<*>) :: WhenMatched f k x y (a -> b) -> WhenMatched f k x y a -> WhenMatched f k x y b # liftA2 :: (a -> b -> c) -> WhenMatched f k x y a -> WhenMatched f k x y b -> WhenMatched f k x y c # (*>) :: WhenMatched f k x y a -> WhenMatched f k x y b -> WhenMatched f k x y b # (<*) :: WhenMatched f k x y a -> WhenMatched f k x y b -> WhenMatched f k x y a # |
foldr :: Foldable t => (a -> b -> b) -> b -> t a -> b #
Right-associative fold of a structure.
In the case of lists, foldr
, when applied to a binary operator, a
starting value (typically the right-identity of the operator), and a
list, reduces the list using the binary operator, from right to left:
foldr f z [x1, x2, ..., xn] == x1 `f` (x2 `f` ... (xn `f` z)...)
Note that, since the head of the resulting expression is produced by
an application of the operator to the first element of the list,
foldr
can produce a terminating expression from an infinite list.
For a general Foldable
structure this should be semantically identical
to,
foldr f z =foldr
f z .toList
length :: Foldable t => t a -> Int #
Returns the size/length of a finite structure as an Int
. The
default implementation is optimized for structures that are similar to
cons-lists, because there is no general way to do better.
null :: Foldable t => t a -> Bool #
Test whether the structure is empty. The default implementation is optimized for structures that are similar to cons-lists, because there is no general way to do better.
foldl :: Foldable t => (b -> a -> b) -> b -> t a -> b #
Left-associative fold of a structure.
In the case of lists, foldl
, when applied to a binary
operator, a starting value (typically the left-identity of the operator),
and a list, reduces the list using the binary operator, from left to
right:
foldl f z [x1, x2, ..., xn] == (...((z `f` x1) `f` x2) `f`...) `f` xn
Note that to produce the outermost application of the operator the
entire input list must be traversed. This means that foldl'
will
diverge if given an infinite list.
Also note that if you want an efficient left-fold, you probably want to
use foldl'
instead of foldl
. The reason for this is that latter does
not force the "inner" results (e.g. z
in the above example)
before applying them to the operator (e.g. to f
x1(
). This results
in a thunk chain f
x2)O(n)
elements long, which then must be evaluated from
the outside-in.
For a general Foldable
structure this should be semantically identical
to,
foldl f z =foldl
f z .toList
foldl' :: Foldable t => (b -> a -> b) -> b -> t a -> b #
Left-associative fold of a structure but with strict application of the operator.
This ensures that each step of the fold is forced to weak head normal
form before being applied, avoiding the collection of thunks that would
otherwise occur. This is often what you want to strictly reduce a finite
list to a single, monolithic result (e.g. length
).
For a general Foldable
structure this should be semantically identical
to,
foldl f z =foldl'
f z .toList
sum :: (Foldable t, Num a) => t a -> a #
The sum
function computes the sum of the numbers of a structure.
product :: (Foldable t, Num a) => t a -> a #
The product
function computes the product of the numbers of a
structure.
class Semigroup a => Monoid a where #
The class of monoids (types with an associative binary operation that has an identity). Instances should satisfy the following laws:
x
<>
mempty
= xmempty
<>
x = xx
(<>
(y<>
z) = (x<>
y)<>
zSemigroup
law)mconcat
=foldr
'(<>)'mempty
The method names refer to the monoid of lists under concatenation, but there are many other instances.
Some types can be viewed as a monoid in more than one way,
e.g. both addition and multiplication on numbers.
In such cases we often define newtype
s and make those instances
of Monoid
, e.g. Sum
and Product
.
NOTE: Semigroup
is a superclass of Monoid
since base-4.11.0.0.
Identity of mappend
An associative operation
NOTE: This method is redundant and has the default
implementation
since base-4.11.0.0.mappend
= '(<>)'
Fold a list using the monoid.
For most types, the default definition for mconcat
will be
used, but the function is included in the class definition so
that an optimized version can be provided for specific types.
Instances
Monoid Ordering | Since: base-2.1 |
Monoid () | Since: base-2.1 |
Monoid ByteString | |
Defined in Data.ByteString.Internal mempty :: ByteString # mappend :: ByteString -> ByteString -> ByteString # mconcat :: [ByteString] -> ByteString # | |
Monoid ByteString | |
Defined in Data.ByteString.Lazy.Internal mempty :: ByteString # mappend :: ByteString -> ByteString -> ByteString # mconcat :: [ByteString] -> ByteString # | |
Monoid All | Since: base-2.1 |
Monoid Any | Since: base-2.1 |
Monoid [a] | Since: base-2.1 |
Semigroup a => Monoid (Maybe a) | Lift a semigroup into Since 4.11.0: constraint on inner Since: base-2.1 |
Monoid a => Monoid (IO a) | Since: base-4.9.0.0 |
(Ord a, Bounded a) => Monoid (Min a) | Since: base-4.9.0.0 |
(Ord a, Bounded a) => Monoid (Max a) | Since: base-4.9.0.0 |
Monoid m => Monoid (WrappedMonoid m) | Since: base-4.9.0.0 |
Defined in Data.Semigroup mempty :: WrappedMonoid m # mappend :: WrappedMonoid m -> WrappedMonoid m -> WrappedMonoid m # mconcat :: [WrappedMonoid m] -> WrappedMonoid m # | |
Semigroup a => Monoid (Option a) | Since: base-4.9.0.0 |
Monoid a => Monoid (Identity a) | |
Monoid (First a) | Since: base-2.1 |
Monoid (Last a) | Since: base-2.1 |
Monoid a => Monoid (Dual a) | Since: base-2.1 |
Monoid (Endo a) | Since: base-2.1 |
Num a => Monoid (Sum a) | Since: base-2.1 |
Num a => Monoid (Product a) | Since: base-2.1 |
Monoid a => Monoid (Down a) | Since: base-4.11.0.0 |
Num a => Monoid (Colour a) | |
Num a => Monoid (AlphaColour a) | |
Defined in Data.Colour.Internal mempty :: AlphaColour a # mappend :: AlphaColour a -> AlphaColour a -> AlphaColour a # mconcat :: [AlphaColour a] -> AlphaColour a # | |
Monoid b => Monoid (a -> b) | Since: base-2.1 |
(Monoid a, Monoid b) => Monoid (a, b) | Since: base-2.1 |
Monoid (Proxy s) | Since: base-4.7.0.0 |
Ord k => Monoid (Map k v) | |
(Monoid a, Monoid b, Monoid c) => Monoid (a, b, c) | Since: base-2.1 |
Monoid a => Monoid (Const a b) | |
Alternative f => Monoid (Alt f a) | Since: base-4.8.0.0 |
(Monoid a, Monoid b, Monoid c, Monoid d) => Monoid (a, b, c, d) | Since: base-2.1 |
(Monoid a, Semigroup (ParsecT s u m a)) => Monoid (ParsecT s u m a) | The Since: parsec-3.1.12 |
(Monoid a, Monoid b, Monoid c, Monoid d, Monoid e) => Monoid (a, b, c, d, e) | Since: base-2.1 |
Rational numbers, with numerator and denominator of some Integral
type.
Instances
Enumerable Rational Source # | |
Parseable Rational Source # | |
Integral a => Enum (Ratio a) | Since: base-2.0.1 |
Eq a => Eq (Ratio a) | |
Integral a => Fractional (Ratio a) | Since: base-2.0.1 |
Integral a => Num (Ratio a) | Since: base-2.0.1 |
Integral a => Ord (Ratio a) | Since: base-2.0.1 |
(Integral a, Read a) => Read (Ratio a) | Since: base-2.1 |
Integral a => Real (Ratio a) | Since: base-2.0.1 |
Defined in GHC.Real toRational :: Ratio a -> Rational # | |
Integral a => RealFrac (Ratio a) | Since: base-2.0.1 |
Show a => Show (Ratio a) | Since: base-2.0.1 |
Hashable a => Hashable (Ratio a) | |
Defined in Data.Hashable.Class |
forkOnWithUnmask :: Int -> ((forall a. IO a -> IO a) -> IO ()) -> IO ThreadId #
Like forkIOWithUnmask
, but the child thread is pinned to the
given CPU, as with forkOn
.
Since: base-4.4.0.0
forkIOWithUnmask :: ((forall a. IO a -> IO a) -> IO ()) -> IO ThreadId #
Like forkIO
, but the child thread is passed a function that can
be used to unmask asynchronous exceptions. This function is
typically used in the following way
... mask_ $ forkIOWithUnmask $ \unmask -> catch (unmask ...) handler
so that the exception handler in the child thread is established with asynchronous exceptions masked, meanwhile the main body of the child thread is executed in the unmasked state.
Note that the unmask function passed to the child thread should only be used in that thread; the behaviour is undefined if it is invoked in a different thread.
Since: base-4.4.0.0
forkOn :: Int -> IO () -> IO ThreadId #
Like forkIO
, but lets you specify on which capability the thread
should run. Unlike a forkIO
thread, a thread created by forkOn
will stay on the same capability for its entire lifetime (forkIO
threads can migrate between capabilities according to the scheduling
policy). forkOn
is useful for overriding the scheduling policy when
you know in advance how best to distribute the threads.
The Int
argument specifies a capability number (see
getNumCapabilities
). Typically capabilities correspond to physical
processors, but the exact behaviour is implementation-dependent. The
value passed to forkOn
is interpreted modulo the total number of
capabilities as returned by getNumCapabilities
.
GHC note: the number of capabilities is specified by the +RTS -N
option when the program is started. Capabilities can be fixed to
actual processor cores with +RTS -qa
if the underlying operating
system supports that, although in practice this is usually unnecessary
(and may actually degrade performance in some cases - experimentation
is recommended).
Since: base-4.4.0.0
forkOS :: IO () -> IO ThreadId #
Like forkIO
, this sparks off a new thread to run the IO
computation passed as the first argument, and returns the ThreadId
of the newly created thread.
However, forkOS
creates a bound thread, which is necessary if you
need to call foreign (non-Haskell) libraries that make use of
thread-local state, such as OpenGL (see Control.Concurrent).
Using forkOS
instead of forkIO
makes no difference at all to the
scheduling behaviour of the Haskell runtime system. It is a common
misconception that you need to use forkOS
instead of forkIO
to
avoid blocking all the Haskell threads when making a foreign call;
this isn't the case. To allow foreign calls to be made without
blocking all the Haskell threads (with GHC), it is only necessary to
use the -threaded
option when linking your program, and to make sure
the foreign import is not marked unsafe
.
A ThreadId
is an abstract type representing a handle to a thread.
ThreadId
is an instance of Eq
, Ord
and Show
, where
the Ord
instance implements an arbitrary total ordering over
ThreadId
s. The Show
instance lets you convert an arbitrary-valued
ThreadId
to string form; showing a ThreadId
value is occasionally
useful when debugging or diagnosing the behaviour of a concurrent
program.
Note: in GHC, if you have a ThreadId
, you essentially have
a pointer to the thread itself. This means the thread itself can't be
garbage collected until you drop the ThreadId
.
This misfeature will hopefully be corrected at a later date.
Instances
Eq ThreadId | Since: base-4.2.0.0 |
Ord ThreadId | Since: base-4.2.0.0 |
Defined in GHC.Conc.Sync | |
Show ThreadId | Since: base-4.2.0.0 |
Hashable ThreadId | |
Defined in Data.Hashable.Class |
class Applicative f => Alternative (f :: * -> *) where #
A monoid on applicative functors.
If defined, some
and many
should be the least solutions
of the equations:
The identity of <|>
(<|>) :: f a -> f a -> f a infixl 3 #
An associative binary operation
One or more.
Zero or more.
Instances
threadWaitWriteSTM :: Fd -> IO (STM (), IO ()) #
Returns an STM action that can be used to wait until data can be written to a file descriptor. The second returned value is an IO action that can be used to deregister interest in the file descriptor.
Since: base-4.7.0.0
threadWaitReadSTM :: Fd -> IO (STM (), IO ()) #
Returns an STM action that can be used to wait for data to read from a file descriptor. The second returned value is an IO action that can be used to deregister interest in the file descriptor.
Since: base-4.7.0.0
threadWaitWrite :: Fd -> IO () #
Block the current thread until data can be written to the given file descriptor (GHC only).
This will throw an IOError
if the file descriptor was closed
while this thread was blocked. To safely close a file descriptor
that has been used with threadWaitWrite
, use
closeFdWith
.
threadWaitRead :: Fd -> IO () #
Block the current thread until data is available to read on the given file descriptor (GHC only).
This will throw an IOError
if the file descriptor was closed
while this thread was blocked. To safely close a file descriptor
that has been used with threadWaitRead
, use
closeFdWith
.
runInUnboundThread :: IO a -> IO a #
Run the IO
computation passed as the first argument. If the calling thread
is bound, an unbound thread is created temporarily using forkIO
.
runInBoundThread
doesn't finish until the IO
computation finishes.
Use this function only in the rare case that you have actually observed a
performance loss due to the use of bound threads. A program that
doesn't need its main thread to be bound and makes heavy use of concurrency
(e.g. a web server), might want to wrap its main
action in
runInUnboundThread
.
Note that exceptions which are thrown to the current thread are thrown in turn to the thread that is executing the given computation. This ensures there's always a way of killing the forked thread.
runInBoundThread :: IO a -> IO a #
Run the IO
computation passed as the first argument. If the calling thread
is not bound, a bound thread is created temporarily. runInBoundThread
doesn't finish until the IO
computation finishes.
You can wrap a series of foreign function calls that rely on thread-local state
with runInBoundThread
so that you can use them without knowing whether the
current thread is bound.
isCurrentThreadBound :: IO Bool #
Returns True
if the calling thread is bound, that is, if it is
safe to use foreign libraries that rely on thread-local state from the
calling thread.
forkOSWithUnmask :: ((forall a. IO a -> IO a) -> IO ()) -> IO ThreadId #
Like forkIOWithUnmask
, but the child thread is a bound thread,
as with forkOS
.
forkFinally :: IO a -> (Either SomeException a -> IO ()) -> IO ThreadId #
Fork a thread and call the supplied function when the thread is about to terminate, with an exception or a returned value. The function is called with asynchronous exceptions masked.
forkFinally action and_then = mask $ \restore -> forkIO $ try (restore action) >>= and_then
This function is useful for informing the parent when a child terminates, for example.
Since: base-4.6.0.0
rtsSupportsBoundThreads :: Bool #
True
if bound threads are supported.
If rtsSupportsBoundThreads
is False
, isCurrentThreadBound
will always return False
and both forkOS
and runInBoundThread
will
fail.
writeList2Chan :: Chan a -> [a] -> IO () #
Write an entire list of items to a Chan
.
getChanContents :: Chan a -> IO [a] #
Return a lazy list representing the contents of the supplied
Chan
, much like hGetContents
.
dupChan :: Chan a -> IO (Chan a) #
Duplicate a Chan
: the duplicate channel begins empty, but data written to
either channel from then on will be available from both. Hence this creates
a kind of broadcast channel, where data written by anyone is seen by
everyone else.
(Note that a duplicated channel is not equal to its original.
So: fmap (c /=) $ dupChan c
returns True
for all c
.)
Read the next value from the Chan
. Blocks when the channel is empty. Since
the read end of a channel is an MVar
, this operation inherits fairness
guarantees of MVar
s (e.g. threads blocked in this operation are woken up in
FIFO order).
Throws BlockedIndefinitelyOnMVar
when the channel is empty and no other
thread holds a reference to the channel.
Chan
is an abstract type representing an unbounded FIFO channel.
signalQSem :: QSem -> IO () #
Signal that a unit of the QSem
is available
Build a new QSem
with a supplied initial quantity.
The initial quantity must be at least 0.
Build a new QSemN
with a supplied initial quantity.
The initial quantity must be at least 0.
approxRational :: RealFrac a => a -> a -> Rational #
approxRational
, applied to two real fractional numbers x
and epsilon
,
returns the simplest rational number within epsilon
of x
.
A rational number y
is said to be simpler than another y'
if
, andabs
(numerator
y) <=abs
(numerator
y')
.denominator
y <=denominator
y'
Any real interval contains a unique simplest rational;
in particular, note that 0/1
is the simplest rational of all.
isSubsequenceOf :: Eq a => [a] -> [a] -> Bool #
The isSubsequenceOf
function takes two lists and returns True
if all
the elements of the first list occur, in order, in the second. The
elements do not have to occur consecutively.
is equivalent to isSubsequenceOf
x y
.elem
x (subsequences
y)
Examples
>>>
isSubsequenceOf "GHC" "The Glorious Haskell Compiler"
True>>>
isSubsequenceOf ['a','d'..'z'] ['a'..'z']
True>>>
isSubsequenceOf [1..10] [10,9..0]
False
Since: base-4.8.0.0
mapAccumR :: Traversable t => (a -> b -> (a, c)) -> a -> t b -> (a, t c) #
mapAccumL :: Traversable t => (a -> b -> (a, c)) -> a -> t b -> (a, t c) #
optional :: Alternative f => f a -> f (Maybe a) #
One or none.
newtype WrappedMonad (m :: * -> *) a #
WrapMonad | |
|
Instances
newtype WrappedArrow (a :: * -> * -> *) b c #
WrapArrow | |
|
Instances
Lists, but with an Applicative
functor based on zipping.
ZipList | |
|
Instances
Functor ZipList | |
Applicative ZipList | f '<$>' 'ZipList' xs1 '<*>' ... '<*>' 'ZipList' xsN = 'ZipList' (zipWithN f xs1 ... xsN) where (\a b c -> stimes c [a, b]) <$> ZipList "abcd" <*> ZipList "567" <*> ZipList [1..] = ZipList (zipWith3 (\a b c -> stimes c [a, b]) "abcd" "567" [1..]) = ZipList {getZipList = ["a5","b6b6","c7c7c7"]} Since: base-2.1 |
Foldable ZipList | |
Defined in Control.Applicative fold :: Monoid m => ZipList m -> m # foldMap :: Monoid m => (a -> m) -> ZipList a -> m # foldr :: (a -> b -> b) -> b -> ZipList a -> b # foldr' :: (a -> b -> b) -> b -> ZipList a -> b # foldl :: (b -> a -> b) -> b -> ZipList a -> b # foldl' :: (b -> a -> b) -> b -> ZipList a -> b # foldr1 :: (a -> a -> a) -> ZipList a -> a # foldl1 :: (a -> a -> a) -> ZipList a -> a # elem :: Eq a => a -> ZipList a -> Bool # maximum :: Ord a => ZipList a -> a # minimum :: Ord a => ZipList a -> a # | |
Traversable ZipList | Since: base-4.9.0.0 |
Alternative ZipList | Since: base-4.11.0.0 |
Eq a => Eq (ZipList a) | |
Ord a => Ord (ZipList a) | |
Defined in Control.Applicative | |
Read a => Read (ZipList a) | |
Show a => Show (ZipList a) | |
Generic (ZipList a) | |
Generic1 ZipList | |
type Rep (ZipList a) | |
Defined in Control.Applicative | |
type Rep1 ZipList | |
Defined in Control.Applicative |
threadDelay :: Int -> IO () #
Suspends the current thread for a given number of microseconds (GHC only).
There is no guarantee that the thread will be rescheduled promptly when the delay has expired, but the thread will never continue to run earlier than specified.
addMVarFinalizer :: MVar a -> IO () -> IO () #
modifyMVarMasked :: MVar a -> (a -> IO (a, b)) -> IO b #
Like modifyMVar
, but the IO
action in the second argument is executed with
asynchronous exceptions masked.
Since: base-4.6.0.0
modifyMVarMasked_ :: MVar a -> (a -> IO a) -> IO () #
Like modifyMVar_
, but the IO
action in the second argument is executed with
asynchronous exceptions masked.
Since: base-4.6.0.0
modifyMVar :: MVar a -> (a -> IO (a, b)) -> IO b #
A slight variation on modifyMVar_
that allows a value to be
returned (b
) in addition to the modified value of the MVar
.
modifyMVar_ :: MVar a -> (a -> IO a) -> IO () #
An exception-safe wrapper for modifying the contents of an MVar
.
Like withMVar
, modifyMVar
will replace the original contents of
the MVar
if an exception is raised during the operation. This
function is only atomic if there are no other producers for this
MVar
.
withMVarMasked :: MVar a -> (a -> IO b) -> IO b #
Like withMVar
, but the IO
action in the second argument is executed
with asynchronous exceptions masked.
Since: base-4.7.0.0
withMVar :: MVar a -> (a -> IO b) -> IO b #
withMVar
is an exception-safe wrapper for operating on the contents
of an MVar
. This operation is exception-safe: it will replace the
original contents of the MVar
if an exception is raised (see
Control.Exception). However, it is only atomic if there are no
other producers for this MVar
.
mkWeakThreadId :: ThreadId -> IO (Weak ThreadId) #
Make a weak pointer to a ThreadId
. It can be important to do
this if you want to hold a reference to a ThreadId
while still
allowing the thread to receive the BlockedIndefinitely
family of
exceptions (e.g. BlockedIndefinitelyOnMVar
). Holding a normal
ThreadId
reference will prevent the delivery of
BlockedIndefinitely
exceptions because the reference could be
used as the target of throwTo
at any time, which would unblock
the thread.
Holding a Weak ThreadId
, on the other hand, will not prevent the
thread from receiving BlockedIndefinitely
exceptions. It is
still possible to throw an exception to a Weak ThreadId
, but the
caller must use deRefWeak
first to determine whether the thread
still exists.
Since: base-4.6.0.0
threadCapability :: ThreadId -> IO (Int, Bool) #
Returns the number of the capability on which the thread is currently
running, and a boolean indicating whether the thread is locked to
that capability or not. A thread is locked to a capability if it
was created with forkOn
.
Since: base-4.4.0.0
The yield
action allows (forces, in a co-operative multitasking
implementation) a context-switch to any other currently runnable
threads (if any), and is occasionally useful when implementing
concurrency abstractions.
myThreadId :: IO ThreadId #
Returns the ThreadId
of the calling thread (GHC only).
throwTo :: Exception e => ThreadId -> e -> IO () #
throwTo
raises an arbitrary exception in the target thread (GHC only).
Exception delivery synchronizes between the source and target thread:
throwTo
does not return until the exception has been raised in the
target thread. The calling thread can thus be certain that the target
thread has received the exception. Exception delivery is also atomic
with respect to other exceptions. Atomicity is a useful property to have
when dealing with race conditions: e.g. if there are two threads that
can kill each other, it is guaranteed that only one of the threads
will get to kill the other.
Whatever work the target thread was doing when the exception was raised is not lost: the computation is suspended until required by another thread.
If the target thread is currently making a foreign call, then the
exception will not be raised (and hence throwTo
will not return)
until the call has completed. This is the case regardless of whether
the call is inside a mask
or not. However, in GHC a foreign call
can be annotated as interruptible
, in which case a throwTo
will
cause the RTS to attempt to cause the call to return; see the GHC
documentation for more details.
Important note: the behaviour of throwTo
differs from that described in
the paper "Asynchronous exceptions in Haskell"
(http://research.microsoft.com/~simonpj/Papers/asynch-exns.htm).
In the paper, throwTo
is non-blocking; but the library implementation adopts
a more synchronous design in which throwTo
does not return until the exception
is received by the target thread. The trade-off is discussed in Section 9 of the paper.
Like any blocking operation, throwTo
is therefore interruptible (see Section 5.3 of
the paper). Unlike other interruptible operations, however, throwTo
is always interruptible, even if it does not actually block.
There is no guarantee that the exception will be delivered promptly,
although the runtime will endeavour to ensure that arbitrary
delays don't occur. In GHC, an exception can only be raised when a
thread reaches a safe point, where a safe point is where memory
allocation occurs. Some loops do not perform any memory allocation
inside the loop and therefore cannot be interrupted by a throwTo
.
If the target of throwTo
is the calling thread, then the behaviour
is the same as throwIO
, except that the exception
is thrown as an asynchronous exception. This means that if there is
an enclosing pure computation, which would be the case if the current
IO operation is inside unsafePerformIO
or unsafeInterleaveIO
, that
computation is not permanently replaced by the exception, but is
suspended as if it had received an asynchronous exception.
Note that if throwTo
is called with the current thread as the
target, the exception will be thrown even if the thread is currently
inside mask
or uninterruptibleMask
.
killThread :: ThreadId -> IO () #
killThread
raises the ThreadKilled
exception in the given
thread (GHC only).
killThread tid = throwTo tid ThreadKilled
setNumCapabilities :: Int -> IO () #
Set the number of Haskell threads that can run truly simultaneously
(on separate physical processors) at any given time. The number
passed to forkOn
is interpreted modulo this value. The initial
value is given by the +RTS -N
runtime flag.
This is also the number of threads that will participate in parallel garbage collection. It is strongly recommended that the number of capabilities is not set larger than the number of physical processor cores, and it may often be beneficial to leave one or more cores free to avoid contention with other processes in the machine.
Since: base-4.5.0.0
getNumCapabilities :: IO Int #
Returns the number of Haskell threads that can run truly
simultaneously (on separate physical processors) at any given time. To change
this value, use setNumCapabilities
.
Since: base-4.4.0.0
forkIO :: IO () -> IO ThreadId #
Creates a new thread to run the IO
computation passed as the
first argument, and returns the ThreadId
of the newly created
thread.
The new thread will be a lightweight, unbound thread. Foreign calls
made by this thread are not guaranteed to be made by any particular OS
thread; if you need foreign calls to be made by a particular OS
thread, then use forkOS
instead.
The new thread inherits the masked state of the parent (see
mask
).
The newly created thread has an exception handler that discards the
exceptions BlockedIndefinitelyOnMVar
, BlockedIndefinitelyOnSTM
, and
ThreadKilled
, and passes all other exceptions to the uncaught
exception handler.
newtype Const a (b :: k) :: forall k. * -> k -> * #
The Const
functor.
Instances
Generic1 (Const a :: k -> *) | |
Eq2 (Const :: * -> * -> *) | Since: base-4.9.0.0 |
Ord2 (Const :: * -> * -> *) | Since: base-4.9.0.0 |
Defined in Data.Functor.Classes | |
Read2 (Const :: * -> * -> *) | Since: base-4.9.0.0 |
Defined in Data.Functor.Classes liftReadsPrec2 :: (Int -> ReadS a) -> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> Int -> ReadS (Const a b) # liftReadList2 :: (Int -> ReadS a) -> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> ReadS [Const a b] # liftReadPrec2 :: ReadPrec a -> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec (Const a b) # liftReadListPrec2 :: ReadPrec a -> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec [Const a b] # | |
Show2 (Const :: * -> * -> *) | Since: base-4.9.0.0 |
Hashable2 (Const :: * -> * -> *) | |
Defined in Data.Hashable.Class | |
Functor (Const m :: * -> *) | Since: base-2.1 |
Monoid m => Applicative (Const m :: * -> *) | Since: base-2.0.1 |
Foldable (Const m :: * -> *) | Since: base-4.7.0.0 |
Defined in Data.Functor.Const fold :: Monoid m0 => Const m m0 -> m0 # foldMap :: Monoid m0 => (a -> m0) -> Const m a -> m0 # foldr :: (a -> b -> b) -> b -> Const m a -> b # foldr' :: (a -> b -> b) -> b -> Const m a -> b # foldl :: (b -> a -> b) -> b -> Const m a -> b # foldl' :: (b -> a -> b) -> b -> Const m a -> b # foldr1 :: (a -> a -> a) -> Const m a -> a # foldl1 :: (a -> a -> a) -> Const m a -> a # elem :: Eq a => a -> Const m a -> Bool # maximum :: Ord a => Const m a -> a # minimum :: Ord a => Const m a -> a # | |
Traversable (Const m :: * -> *) | Since: base-4.7.0.0 |
Eq a => Eq1 (Const a :: * -> *) | Since: base-4.9.0.0 |
Ord a => Ord1 (Const a :: * -> *) | Since: base-4.9.0.0 |
Defined in Data.Functor.Classes | |
Read a => Read1 (Const a :: * -> *) | Since: base-4.9.0.0 |
Defined in Data.Functor.Classes | |
Show a => Show1 (Const a :: * -> *) | Since: base-4.9.0.0 |
Hashable a => Hashable1 (Const a :: * -> *) | |
Defined in Data.Hashable.Class | |
Bounded a => Bounded (Const a b) | |
Enum a => Enum (Const a b) | |
Defined in Data.Functor.Const succ :: Const a b -> Const a b # pred :: Const a b -> Const a b # fromEnum :: Const a b -> Int # enumFrom :: Const a b -> [Const a b] # enumFromThen :: Const a b -> Const a b -> [Const a b] # enumFromTo :: Const a b -> Const a b -> [Const a b] # enumFromThenTo :: Const a b -> Const a b -> Const a b -> [Const a b] # | |
Eq a => Eq (Const a b) | |
Floating a => Floating (Const a b) | |
Defined in Data.Functor.Const exp :: Const a b -> Const a b # log :: Const a b -> Const a b # sqrt :: Const a b -> Const a b # (**) :: Const a b -> Const a b -> Const a b # logBase :: Const a b -> Const a b -> Const a b # sin :: Const a b -> Const a b # cos :: Const a b -> Const a b # tan :: Const a b -> Const a b # asin :: Const a b -> Const a b # acos :: Const a b -> Const a b # atan :: Const a b -> Const a b # sinh :: Const a b -> Const a b # cosh :: Const a b -> Const a b # tanh :: Const a b -> Const a b # asinh :: Const a b -> Const a b # acosh :: Const a b -> Const a b # atanh :: Const a b -> Const a b # log1p :: Const a b -> Const a b # expm1 :: Const a b -> Const a b # | |
Fractional a => Fractional (Const a b) | |
Integral a => Integral (Const a b) | |
Defined in Data.Functor.Const | |
Num a => Num (Const a b) | |
Ord a => Ord (Const a b) | |
Defined in Data.Functor.Const | |
Read a => Read (Const a b) | This instance would be equivalent to the derived instances of the
Since: base-4.8.0.0 |
Real a => Real (Const a b) | |
Defined in Data.Functor.Const toRational :: Const a b -> Rational # | |
RealFloat a => RealFloat (Const a b) | |
Defined in Data.Functor.Const floatRadix :: Const a b -> Integer # floatDigits :: Const a b -> Int # floatRange :: Const a b -> (Int, Int) # decodeFloat :: Const a b -> (Integer, Int) # encodeFloat :: Integer -> Int -> Const a b # exponent :: Const a b -> Int # significand :: Const a b -> Const a b # scaleFloat :: Int -> Const a b -> Const a b # isInfinite :: Const a b -> Bool # isDenormalized :: Const a b -> Bool # isNegativeZero :: Const a b -> Bool # | |
RealFrac a => RealFrac (Const a b) | |
Show a => Show (Const a b) | This instance would be equivalent to the derived instances of the
Since: base-4.8.0.0 |
Ix a => Ix (Const a b) | |
Defined in Data.Functor.Const range :: (Const a b, Const a b) -> [Const a b] # index :: (Const a b, Const a b) -> Const a b -> Int # unsafeIndex :: (Const a b, Const a b) -> Const a b -> Int inRange :: (Const a b, Const a b) -> Const a b -> Bool # rangeSize :: (Const a b, Const a b) -> Int # unsafeRangeSize :: (Const a b, Const a b) -> Int | |
IsString a => IsString (Const a b) | Since: base-4.9.0.0 |
Defined in Data.String fromString :: String -> Const a b # | |
Generic (Const a b) | |
Semigroup a => Semigroup (Const a b) | |
Monoid a => Monoid (Const a b) | |
Storable a => Storable (Const a b) | |
Defined in Data.Functor.Const | |
Bits a => Bits (Const a b) | |
Defined in Data.Functor.Const (.&.) :: Const a b -> Const a b -> Const a b # (.|.) :: Const a b -> Const a b -> Const a b # xor :: Const a b -> Const a b -> Const a b # complement :: Const a b -> Const a b # shift :: Const a b -> Int -> Const a b # rotate :: Const a b -> Int -> Const a b # setBit :: Const a b -> Int -> Const a b # clearBit :: Const a b -> Int -> Const a b # complementBit :: Const a b -> Int -> Const a b # testBit :: Const a b -> Int -> Bool # bitSizeMaybe :: Const a b -> Maybe Int # isSigned :: Const a b -> Bool # shiftL :: Const a b -> Int -> Const a b # unsafeShiftL :: Const a b -> Int -> Const a b # shiftR :: Const a b -> Int -> Const a b # unsafeShiftR :: Const a b -> Int -> Const a b # rotateL :: Const a b -> Int -> Const a b # | |
FiniteBits a => FiniteBits (Const a b) | |
Defined in Data.Functor.Const finiteBitSize :: Const a b -> Int # countLeadingZeros :: Const a b -> Int # countTrailingZeros :: Const a b -> Int # | |
Hashable a => Hashable (Const a b) | |
Defined in Data.Hashable.Class | |
type Rep1 (Const a :: k -> *) | |
Defined in Data.Functor.Const | |
type Rep (Const a b) | |
Defined in Data.Functor.Const |
minimumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a #
The least element of a non-empty structure with respect to the given comparison function.
maximumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a #
The largest element of a non-empty structure with respect to the given comparison function.
all :: Foldable t => (a -> Bool) -> t a -> Bool #
Determines whether all elements of the structure satisfy the predicate.
any :: Foldable t => (a -> Bool) -> t a -> Bool #
Determines whether any element of the structure satisfies the predicate.
concatMap :: Foldable t => (a -> [b]) -> t a -> [b] #
Map a function over all the elements of a container and concatenate the resulting lists.
concat :: Foldable t => t [a] -> [a] #
The concatenation of all the elements of a container of lists.
Maybe monoid returning the leftmost non-Nothing value.
is isomorphic to First
a
, but precedes it
historically.Alt
Maybe
a
>>>
getFirst (First (Just "hello") <> First Nothing <> First (Just "world"))
Just "hello"
Instances
Monad First | |
Functor First | |
Applicative First | |
Foldable First | Since: base-4.8.0.0 |
Defined in Data.Foldable fold :: Monoid m => First m -> m # foldMap :: Monoid m => (a -> m) -> First a -> m # foldr :: (a -> b -> b) -> b -> First a -> b # foldr' :: (a -> b -> b) -> b -> First a -> b # foldl :: (b -> a -> b) -> b -> First a -> b # foldl' :: (b -> a -> b) -> b -> First a -> b # foldr1 :: (a -> a -> a) -> First a -> a # foldl1 :: (a -> a -> a) -> First a -> a # elem :: Eq a => a -> First a -> Bool # maximum :: Ord a => First a -> a # minimum :: Ord a => First a -> a # | |
Traversable First | Since: base-4.8.0.0 |
Eq a => Eq (First a) | |
Ord a => Ord (First a) | |
Read a => Read (First a) | |
Show a => Show (First a) | |
Generic (First a) | |
Semigroup (First a) | Since: base-4.9.0.0 |
Monoid (First a) | Since: base-2.1 |
Generic1 First | |
type Rep (First a) | |
Defined in Data.Monoid | |
type Rep1 First | |
Defined in Data.Monoid |
Maybe monoid returning the rightmost non-Nothing value.
is isomorphic to Last
a
, and thus to
Dual
(First
a)Dual
(Alt
Maybe
a)
>>>
getLast (Last (Just "hello") <> Last Nothing <> Last (Just "world"))
Just "world"
Instances
Monad Last | |
Functor Last | |
Applicative Last | |
Foldable Last | Since: base-4.8.0.0 |
Defined in Data.Foldable fold :: Monoid m => Last m -> m # foldMap :: Monoid m => (a -> m) -> Last a -> m # foldr :: (a -> b -> b) -> b -> Last a -> b # foldr' :: (a -> b -> b) -> b -> Last a -> b # foldl :: (b -> a -> b) -> b -> Last a -> b # foldl' :: (b -> a -> b) -> b -> Last a -> b # foldr1 :: (a -> a -> a) -> Last a -> a # foldl1 :: (a -> a -> a) -> Last a -> a # elem :: Eq a => a -> Last a -> Bool # maximum :: Ord a => Last a -> a # | |
Traversable Last | Since: base-4.8.0.0 |
Eq a => Eq (Last a) | |
Ord a => Ord (Last a) | |
Read a => Read (Last a) | |
Show a => Show (Last a) | |
Generic (Last a) | |
Semigroup (Last a) | Since: base-4.9.0.0 |
Monoid (Last a) | Since: base-2.1 |
Generic1 Last | |
type Rep (Last a) | |
Defined in Data.Monoid | |
type Rep1 Last | |
Defined in Data.Monoid |
The dual of a Monoid
, obtained by swapping the arguments of mappend
.
>>>
getDual (mappend (Dual "Hello") (Dual "World"))
"WorldHello"
Instances
Monad Dual | Since: base-4.8.0.0 |
Functor Dual | Since: base-4.8.0.0 |
Applicative Dual | Since: base-4.8.0.0 |
Foldable Dual | Since: base-4.8.0.0 |
Defined in Data.Foldable fold :: Monoid m => Dual m -> m # foldMap :: Monoid m => (a -> m) -> Dual a -> m # foldr :: (a -> b -> b) -> b -> Dual a -> b # foldr' :: (a -> b -> b) -> b -> Dual a -> b # foldl :: (b -> a -> b) -> b -> Dual a -> b # foldl' :: (b -> a -> b) -> b -> Dual a -> b # foldr1 :: (a -> a -> a) -> Dual a -> a # foldl1 :: (a -> a -> a) -> Dual a -> a # elem :: Eq a => a -> Dual a -> Bool # maximum :: Ord a => Dual a -> a # | |
Traversable Dual | Since: base-4.8.0.0 |
Bounded a => Bounded (Dual a) | |
Eq a => Eq (Dual a) | |
Ord a => Ord (Dual a) | |
Read a => Read (Dual a) | |
Show a => Show (Dual a) | |
Generic (Dual a) | |
Semigroup a => Semigroup (Dual a) | Since: base-4.9.0.0 |
Monoid a => Monoid (Dual a) | Since: base-2.1 |
Generic1 Dual | |
type Rep (Dual a) | |
Defined in Data.Semigroup.Internal | |
type Rep1 Dual | |
Defined in Data.Semigroup.Internal |
The monoid of endomorphisms under composition.
>>>
let computation = Endo ("Hello, " ++) <> Endo (++ "!")
>>>
appEndo computation "Haskell"
"Hello, Haskell!"
Boolean monoid under conjunction (&&
).
>>>
getAll (All True <> mempty <> All False)
False
>>>
getAll (mconcat (map (\x -> All (even x)) [2,4,6,7,8]))
False
Boolean monoid under disjunction (||
).
>>>
getAny (Any True <> mempty <> Any False)
True
>>>
getAny (mconcat (map (\x -> Any (even x)) [2,4,6,7,8]))
True
Monoid under addition.
>>>
getSum (Sum 1 <> Sum 2 <> mempty)
3
Instances
Monad Sum | Since: base-4.8.0.0 |
Functor Sum | Since: base-4.8.0.0 |
Applicative Sum | Since: base-4.8.0.0 |
Foldable Sum | Since: base-4.8.0.0 |
Defined in Data.Foldable fold :: Monoid m => Sum m -> m # foldMap :: Monoid m => (a -> m) -> Sum a -> m # foldr :: (a -> b -> b) -> b -> Sum a -> b # foldr' :: (a -> b -> b) -> b -> Sum a -> b # foldl :: (b -> a -> b) -> b -> Sum a -> b # foldl' :: (b -> a -> b) -> b -> Sum a -> b # foldr1 :: (a -> a -> a) -> Sum a -> a # foldl1 :: (a -> a -> a) -> Sum a -> a # elem :: Eq a => a -> Sum a -> Bool # maximum :: Ord a => Sum a -> a # | |
Traversable Sum | Since: base-4.8.0.0 |
Bounded a => Bounded (Sum a) | |
Eq a => Eq (Sum a) | |
Num a => Num (Sum a) | |
Ord a => Ord (Sum a) | |
Read a => Read (Sum a) | |
Show a => Show (Sum a) | |
Generic (Sum a) | |
Num a => Semigroup (Sum a) | Since: base-4.9.0.0 |
Num a => Monoid (Sum a) | Since: base-2.1 |
Generic1 Sum | |
type Rep (Sum a) | |
Defined in Data.Semigroup.Internal | |
type Rep1 Sum | |
Defined in Data.Semigroup.Internal |
Monoid under multiplication.
>>>
getProduct (Product 3 <> Product 4 <> mempty)
12
Product | |
|
Instances
Monad Product | Since: base-4.8.0.0 |
Functor Product | Since: base-4.8.0.0 |
Applicative Product | Since: base-4.8.0.0 |
Foldable Product | Since: base-4.8.0.0 |
Defined in Data.Foldable fold :: Monoid m => Product m -> m # foldMap :: Monoid m => (a -> m) -> Product a -> m # foldr :: (a -> b -> b) -> b -> Product a -> b # foldr' :: (a -> b -> b) -> b -> Product a -> b # foldl :: (b -> a -> b) -> b -> Product a -> b # foldl' :: (b -> a -> b) -> b -> Product a -> b # foldr1 :: (a -> a -> a) -> Product a -> a # foldl1 :: (a -> a -> a) -> Product a -> a # elem :: Eq a => a -> Product a -> Bool # maximum :: Ord a => Product a -> a # minimum :: Ord a => Product a -> a # | |
Traversable Product | Since: base-4.8.0.0 |
Bounded a => Bounded (Product a) | |
Eq a => Eq (Product a) | |
Num a => Num (Product a) | |
Defined in Data.Semigroup.Internal | |
Ord a => Ord (Product a) | |
Defined in Data.Semigroup.Internal | |
Read a => Read (Product a) | |
Show a => Show (Product a) | |
Generic (Product a) | |
Num a => Semigroup (Product a) | Since: base-4.9.0.0 |
Num a => Monoid (Product a) | Since: base-2.1 |
Generic1 Product | |
type Rep (Product a) | |
Defined in Data.Semigroup.Internal | |
type Rep1 Product | |
Defined in Data.Semigroup.Internal |
newtype Alt (f :: k -> *) (a :: k) :: forall k. (k -> *) -> k -> * #
Monoid under <|>
.
Since: base-4.8.0.0
Instances
Generic1 (Alt f :: k -> *) | |
Monad f => Monad (Alt f) | |
Functor f => Functor (Alt f) | |
Applicative f => Applicative (Alt f) | |
Alternative f => Alternative (Alt f) | |
MonadPlus f => MonadPlus (Alt f) | |
Enum (f a) => Enum (Alt f a) | |
Eq (f a) => Eq (Alt f a) | |
Num (f a) => Num (Alt f a) | |
Ord (f a) => Ord (Alt f a) | |
Read (f a) => Read (Alt f a) | |
Show (f a) => Show (Alt f a) | |
Generic (Alt f a) | |
Alternative f => Semigroup (Alt f a) | Since: base-4.9.0.0 |
Alternative f => Monoid (Alt f a) | Since: base-4.8.0.0 |
type Rep1 (Alt f :: k -> *) | |
Defined in Data.Semigroup.Internal | |
type Rep (Alt f a) | |
Defined in Data.Semigroup.Internal |
words
breaks a string up into a list of words, which were delimited
by white space.
>>>
words "Lorem ipsum\ndolor"
["Lorem","ipsum","dolor"]
lines
breaks a string up into a list of strings at newline
characters. The resulting strings do not contain newlines.
Note that after splitting the string at newline characters, the last part of the string is considered a line even if it doesn't end with a newline. For example,
>>>
lines ""
[]
>>>
lines "\n"
[""]
>>>
lines "one"
["one"]
>>>
lines "one\n"
["one"]
>>>
lines "one\n\n"
["one",""]
>>>
lines "one\ntwo"
["one","two"]
>>>
lines "one\ntwo\n"
["one","two"]
Thus
contains at least as many elements as newlines in lines
ss
.
unfoldr :: (b -> Maybe (a, b)) -> b -> [a] #
The unfoldr
function is a `dual' to foldr
: while foldr
reduces a list to a summary value, unfoldr
builds a list from
a seed value. The function takes the element and returns Nothing
if it is done producing the list or returns Just
(a,b)
, in which
case, a
is a prepended to the list and b
is used as the next
element in a recursive call. For example,
iterate f == unfoldr (\x -> Just (x, f x))
In some cases, unfoldr
can undo a foldr
operation:
unfoldr f' (foldr f z xs) == xs
if the following holds:
f' (f x y) = Just (x,y) f' z = Nothing
A simple use of unfoldr:
>>>
unfoldr (\b -> if b == 0 then Nothing else Just (b, b-1)) 10
[10,9,8,7,6,5,4,3,2,1]
sortOn :: Ord b => (a -> b) -> [a] -> [a] #
Sort a list by comparing the results of a key function applied to each
element. sortOn f
is equivalent to sortBy (comparing f)
, but has the
performance advantage of only evaluating f
once for each element in the
input list. This is called the decorate-sort-undecorate paradigm, or
Schwartzian transform.
Elements are arranged from from lowest to highest, keeping duplicates in the order they appeared in the input.
>>>
sortOn fst [(2, "world"), (4, "!"), (1, "Hello")]
[(1,"Hello"),(2,"world"),(4,"!")]
Since: base-4.8.0.0
The sort
function implements a stable sorting algorithm.
It is a special case of sortBy
, which allows the programmer to supply
their own comparison function.
Elements are arranged from from lowest to highest, keeping duplicates in the order they appeared in the input.
>>>
sort [1,6,4,3,2,5]
[1,2,3,4,5,6]
permutations :: [a] -> [[a]] #
The permutations
function returns the list of all permutations of the argument.
>>>
permutations "abc"
["abc","bac","cba","bca","cab","acb"]
subsequences :: [a] -> [[a]] #
The subsequences
function returns the list of all subsequences of the argument.
>>>
subsequences "abc"
["","a","b","ab","c","ac","bc","abc"]
group :: Eq a => [a] -> [[a]] #
The group
function takes a list and returns a list of lists such
that the concatenation of the result is equal to the argument. Moreover,
each sublist in the result contains only equal elements. For example,
>>>
group "Mississippi"
["M","i","ss","i","ss","i","pp","i"]
It is a special case of groupBy
, which allows the programmer to supply
their own equality test.
deleteFirstsBy :: (a -> a -> Bool) -> [a] -> [a] -> [a] #
The deleteFirstsBy
function takes a predicate and two lists and
returns the first list with the first occurrence of each element of
the second list removed.
zipWith7 :: (a -> b -> c -> d -> e -> f -> g -> h) -> [a] -> [b] -> [c] -> [d] -> [e] -> [f] -> [g] -> [h] #
genericReplicate :: Integral i => i -> a -> [a] #
The genericReplicate
function is an overloaded version of replicate
,
which accepts any Integral
value as the number of repetitions to make.
genericIndex :: Integral i => [a] -> i -> a #
The genericIndex
function is an overloaded version of !!
, which
accepts any Integral
value as the index.
genericSplitAt :: Integral i => i -> [a] -> ([a], [a]) #
The genericSplitAt
function is an overloaded version of splitAt
, which
accepts any Integral
value as the position at which to split.
genericDrop :: Integral i => i -> [a] -> [a] #
The genericDrop
function is an overloaded version of drop
, which
accepts any Integral
value as the number of elements to drop.
genericTake :: Integral i => i -> [a] -> [a] #
The genericTake
function is an overloaded version of take
, which
accepts any Integral
value as the number of elements to take.
genericLength :: Num i => [a] -> i #
The genericLength
function is an overloaded version of length
. In
particular, instead of returning an Int
, it returns any type which is
an instance of Num
. It is, however, less efficient than length
.
insert :: Ord a => a -> [a] -> [a] #
The insert
function takes an element and a list and inserts the
element into the list at the first position where it is less
than or equal to the next element. In particular, if the list
is sorted before the call, the result will also be sorted.
It is a special case of insertBy
, which allows the programmer to
supply their own comparison function.
>>>
insert 4 [1,2,3,5,6,7]
[1,2,3,4,5,6,7]
partition :: (a -> Bool) -> [a] -> ([a], [a]) #
The partition
function takes a predicate a list and returns
the pair of lists of elements which do and do not satisfy the
predicate, respectively; i.e.,
partition p xs == (filter p xs, filter (not . p) xs)
>>>
partition (`elem` "aeiou") "Hello World!"
("eoo","Hll Wrld!")
The transpose
function transposes the rows and columns of its argument.
For example,
>>>
transpose [[1,2,3],[4,5,6]]
[[1,4],[2,5],[3,6]]
If some of the rows are shorter than the following rows, their elements are skipped:
>>>
transpose [[10,11],[20],[],[30,31,32]]
[[10,20,30],[11,31],[32]]
intercalate :: [a] -> [[a]] -> [a] #
intercalate
xs xss
is equivalent to (
.
It inserts the list concat
(intersperse
xs xss))xs
in between the lists in xss
and concatenates the
result.
>>>
intercalate ", " ["Lorem", "ipsum", "dolor"]
"Lorem, ipsum, dolor"
intersperse :: a -> [a] -> [a] #
The intersperse
function takes an element and a list and
`intersperses' that element between the elements of the list.
For example,
>>>
intersperse ',' "abcde"
"a,b,c,d,e"
intersectBy :: (a -> a -> Bool) -> [a] -> [a] -> [a] #
The intersectBy
function is the non-overloaded version of intersect
.
intersect :: Eq a => [a] -> [a] -> [a] #
The intersect
function takes the list intersection of two lists.
For example,
>>>
[1,2,3,4] `intersect` [2,4,6,8]
[2,4]
If the first list contains duplicates, so will the result.
>>>
[1,2,2,3,4] `intersect` [6,4,4,2]
[2,2,4]
It is a special case of intersectBy
, which allows the programmer to
supply their own equality test. If the element is found in both the first
and the second list, the element from the first list will be used.
union :: Eq a => [a] -> [a] -> [a] #
The union
function returns the list union of the two lists.
For example,
>>>
"dog" `union` "cow"
"dogcw"
Duplicates, and elements of the first list, are removed from the
the second list, but if the first list contains duplicates, so will
the result.
It is a special case of unionBy
, which allows the programmer to supply
their own equality test.
(\\) :: Eq a => [a] -> [a] -> [a] infix 5 #
The \\
function is list difference (non-associative).
In the result of xs
\\
ys
, the first occurrence of each element of
ys
in turn (if any) has been removed from xs
. Thus
(xs ++ ys) \\ xs == ys.
>>>
"Hello World!" \\ "ell W"
"Hoorld!"
It is a special case of deleteFirstsBy
, which allows the programmer
to supply their own equality test.
O(n^2). The nub
function removes duplicate elements from a list.
In particular, it keeps only the first occurrence of each element.
(The name nub
means `essence'.)
It is a special case of nubBy
, which allows the programmer to supply
their own equality test.
>>>
nub [1,2,3,4,3,2,1,2,4,3,5]
[1,2,3,4,5]
isSuffixOf :: Eq a => [a] -> [a] -> Bool #
The isSuffixOf
function takes two lists and returns True
iff
the first list is a suffix of the second. The second list must be
finite.
>>>
"ld!" `isSuffixOf` "Hello World!"
True
>>>
"World" `isSuffixOf` "Hello World!"
False
isPrefixOf :: Eq a => [a] -> [a] -> Bool #
The isPrefixOf
function takes two lists and returns True
iff the first list is a prefix of the second.
>>>
"Hello" `isPrefixOf` "Hello World!"
True
>>>
"Hello" `isPrefixOf` "Wello Horld!"
False
findIndices :: (a -> Bool) -> [a] -> [Int] #
The findIndices
function extends findIndex
, by returning the
indices of all elements satisfying the predicate, in ascending order.
>>>
findIndices (`elem` "aeiou") "Hello World!"
[1,4,7]
elemIndices :: Eq a => a -> [a] -> [Int] #
The elemIndices
function extends elemIndex
, by returning the
indices of all elements equal to the query element, in ascending order.
>>>
elemIndices 'o' "Hello World"
[4,7]
stripPrefix :: Eq a => [a] -> [a] -> Maybe [a] #
The stripPrefix
function drops the given prefix from a list.
It returns Nothing
if the list did not start with the prefix
given, or Just
the list after the prefix, if it does.
>>>
stripPrefix "foo" "foobar"
Just "bar"
>>>
stripPrefix "foo" "foo"
Just ""
>>>
stripPrefix "foo" "barfoo"
Nothing
>>>
stripPrefix "foo" "barfoobaz"
Nothing
dropWhileEnd :: (a -> Bool) -> [a] -> [a] #
The dropWhileEnd
function drops the largest suffix of a list
in which the given predicate holds for all elements. For example:
>>>
dropWhileEnd isSpace "foo\n"
"foo"
>>>
dropWhileEnd isSpace "foo bar"
"foo bar"
dropWhileEnd isSpace ("foo\n" ++ undefined) == "foo" ++ undefined
Since: base-4.5.0.0
(<$>) :: Functor f => (a -> b) -> f a -> f b infixl 4 #
An infix synonym for fmap
.
The name of this operator is an allusion to $
.
Note the similarities between their types:
($) :: (a -> b) -> a -> b (<$>) :: Functor f => (a -> b) -> f a -> f b
Whereas $
is function application, <$>
is function
application lifted over a Functor
.
Examples
Convert from a
to a Maybe
Int
using Maybe
String
show
:
>>>
show <$> Nothing
Nothing>>>
show <$> Just 3
Just "3"
Convert from an
to an Either
Int
Int
Either
Int
String
using show
:
>>>
show <$> Left 17
Left 17>>>
show <$> Right 17
Right "17"
Double each element of a list:
>>>
(*2) <$> [1,2,3]
[2,4,6]
Apply even
to the second element of a pair:
>>>
even <$> (2,2)
(2,True)
denominator :: Ratio a -> a #
Extract the denominator of the ratio in reduced form: the numerator and denominator have no common factor and the denominator is positive.
Extract the numerator of the ratio in reduced form: the numerator and denominator have no common factor and the denominator is positive.
unzip :: [(a, b)] -> ([a], [b]) #
unzip
transforms a list of pairs into a list of first components
and a list of second components.
(!!) :: [a] -> Int -> a infixl 9 #
List index (subscript) operator, starting from 0.
It is an instance of the more general genericIndex
,
which takes an index of any integral type.
lookup :: Eq a => a -> [(a, b)] -> Maybe b #
lookup
key assocs
looks up a key in an association list.
break :: (a -> Bool) -> [a] -> ([a], [a]) #
break
, applied to a predicate p
and a list xs
, returns a tuple where
first element is longest prefix (possibly empty) of xs
of elements that
do not satisfy p
and second element is the remainder of the list:
break (> 3) [1,2,3,4,1,2,3,4] == ([1,2,3],[4,1,2,3,4]) break (< 9) [1,2,3] == ([],[1,2,3]) break (> 9) [1,2,3] == ([1,2,3],[])
span :: (a -> Bool) -> [a] -> ([a], [a]) #
span
, applied to a predicate p
and a list xs
, returns a tuple where
first element is longest prefix (possibly empty) of xs
of elements that
satisfy p
and second element is the remainder of the list:
span (< 3) [1,2,3,4,1,2,3,4] == ([1,2],[3,4,1,2,3,4]) span (< 9) [1,2,3] == ([1,2,3],[]) span (< 0) [1,2,3] == ([],[1,2,3])
splitAt :: Int -> [a] -> ([a], [a]) #
splitAt
n xs
returns a tuple where first element is xs
prefix of
length n
and second element is the remainder of the list:
splitAt 6 "Hello World!" == ("Hello ","World!") splitAt 3 [1,2,3,4,5] == ([1,2,3],[4,5]) splitAt 1 [1,2,3] == ([1],[2,3]) splitAt 3 [1,2,3] == ([1,2,3],[]) splitAt 4 [1,2,3] == ([1,2,3],[]) splitAt 0 [1,2,3] == ([],[1,2,3]) splitAt (-1) [1,2,3] == ([],[1,2,3])
It is equivalent to (
when take
n xs, drop
n xs)n
is not _|_
(splitAt _|_ xs = _|_
).
splitAt
is an instance of the more general genericSplitAt
,
in which n
may be of any integral type.
drop
n xs
returns the suffix of xs
after the first n
elements, or []
if n >
:length
xs
drop 6 "Hello World!" == "World!" drop 3 [1,2,3,4,5] == [4,5] drop 3 [1,2] == [] drop 3 [] == [] drop (-1) [1,2] == [1,2] drop 0 [1,2] == [1,2]
It is an instance of the more general genericDrop
,
in which n
may be of any integral type.
take
n
, applied to a list xs
, returns the prefix of xs
of length n
, or xs
itself if n >
:length
xs
take 5 "Hello World!" == "Hello" take 3 [1,2,3,4,5] == [1,2,3] take 3 [1,2] == [1,2] take 3 [] == [] take (-1) [1,2] == [] take 0 [1,2] == []
It is an instance of the more general genericTake
,
in which n
may be of any integral type.
takeWhile :: (a -> Bool) -> [a] -> [a] #
takeWhile
, applied to a predicate p
and a list xs
, returns the
longest prefix (possibly empty) of xs
of elements that satisfy p
:
takeWhile (< 3) [1,2,3,4,1,2,3,4] == [1,2] takeWhile (< 9) [1,2,3] == [1,2,3] takeWhile (< 0) [1,2,3] == []
cycle
ties a finite list into a circular one, or equivalently,
the infinite repetition of the original list. It is the identity
on infinite lists.
replicate :: Int -> a -> [a] #
replicate
n x
is a list of length n
with x
the value of
every element.
It is an instance of the more general genericReplicate
,
in which n
may be of any integral type.
iterate' :: (a -> a) -> a -> [a] #
'iterate\'' is the strict version of iterate
.
It ensures that the result of each application of force to weak head normal form before proceeding.
Return all the elements of a list except the last one. The list must be non-empty.
isEmptyMVar :: MVar a -> IO Bool #
Check whether a given MVar
is empty.
Notice that the boolean value returned is just a snapshot of
the state of the MVar. By the time you get to react on its result,
the MVar may have been filled (or emptied) - so be extremely
careful when using this operation. Use tryTakeMVar
instead if possible.
tryReadMVar :: MVar a -> IO (Maybe a) #
tryPutMVar :: MVar a -> a -> IO Bool #
A non-blocking version of putMVar
. The tryPutMVar
function
attempts to put the value a
into the MVar
, returning True
if
it was successful, or False
otherwise.
tryTakeMVar :: MVar a -> IO (Maybe a) #
A non-blocking version of takeMVar
. The tryTakeMVar
function
returns immediately, with Nothing
if the MVar
was empty, or
if the Just
aMVar
was full with contents a
. After tryTakeMVar
,
the MVar
is left empty.
putMVar :: MVar a -> a -> IO () #
Put a value into an MVar
. If the MVar
is currently full,
putMVar
will wait until it becomes empty.
There are two further important properties of putMVar
:
putMVar
is single-wakeup. That is, if there are multiple threads blocked inputMVar
, and theMVar
becomes empty, only one thread will be woken up. The runtime guarantees that the woken thread completes itsputMVar
operation.- When multiple threads are blocked on an
MVar
, they are woken up in FIFO order. This is useful for providing fairness properties of abstractions built usingMVar
s.
Atomically read the contents of an MVar
. If the MVar
is
currently empty, readMVar
will wait until it is full.
readMVar
is guaranteed to receive the next putMVar
.
readMVar
is multiple-wakeup, so when multiple readers are
blocked on an MVar
, all of them are woken up at the same time.
Compatibility note: Prior to base 4.7, readMVar
was a combination
of takeMVar
and putMVar
. This mean that in the presence of
other threads attempting to putMVar
, readMVar
could block.
Furthermore, readMVar
would not receive the next putMVar
if there
was already a pending thread blocked on takeMVar
. The old behavior
can be recovered by implementing 'readMVar as follows:
readMVar :: MVar a -> IO a readMVar m = mask_ $ do a <- takeMVar m putMVar m a return a
Return the contents of the MVar
. If the MVar
is currently
empty, takeMVar
will wait until it is full. After a takeMVar
,
the MVar
is left empty.
There are two further important properties of takeMVar
:
takeMVar
is single-wakeup. That is, if there are multiple threads blocked intakeMVar
, and theMVar
becomes full, only one thread will be woken up. The runtime guarantees that the woken thread completes itstakeMVar
operation.- When multiple threads are blocked on an
MVar
, they are woken up in FIFO order. This is useful for providing fairness properties of abstractions built usingMVar
s.
newEmptyMVar :: IO (MVar a) #
Create an MVar
which is initially empty.
An MVar
(pronounced "em-var") is a synchronising variable, used
for communication between concurrent threads. It can be thought of
as a a box, which may be empty or full.
liftA3 :: Applicative f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d #
Lift a ternary function to actions.
liftA :: Applicative f => (a -> b) -> f a -> f b #
(<**>) :: Applicative f => f a -> f (a -> b) -> f b infixl 4 #
A variant of <*>
with the arguments reversed.
type Event a = (Arc, Arc, a) Source #
An Event is a value that occurs during the period given by the
first Arc
. The second one indicates the event's "domain of
influence". These will often be the same, but many temporal
transformations, such as rotation and scaling time, may result in
arcs being split or truncated. In such cases, the first arc is
preserved, but the second arc reflects the portion of the event
which is relevant.
type Arc = (Time, Time) Source #
(s,e) :: Arc
represents a time interval with a start and end value.
{ t : s <= t && t < e }
Time is represented by a rational number. Each natural number represents both the start of the next rhythmic cycle, and the end of the previous one. Rational numbers are used so that subdivisions of each cycle can be accurately represented.
The starting point of the current cycle. A cycle occurs from each
natural number to the next, so this is equivalent to floor
.
nextSam :: Time -> Time Source #
The end point of the current cycle (and starting point of the next cycle)
arcCycles' :: Arc -> [Arc] Source #
Splits the given Arc
into a list of Arc
s, at cycle boundaries, but wrapping the arcs within the same cycle.
subArc :: Arc -> Arc -> Maybe Arc Source #
subArc i j
is the arc that is the intersection of i
and j
.
mapArc :: (Time -> Time) -> Arc -> Arc Source #
Map the given function over both the start and end Time
values
of the given Arc
.
mapCycle :: (Time -> Time) -> Arc -> Arc Source #
Similar to mapArc
but time is relative to the cycle (i.e. the
sam of the start of the arc)
mirrorArc :: Time -> Arc -> Arc Source #
Returns the `mirror image' of an Arc
around the given point intime, used by Sound.Tidal.Pattern.rev
.
eventStart :: Event a -> Time Source #
The start time of the given Event
eventOnset :: Event a -> Time Source #
The original onset of the given Event
eventOffset :: Event a -> Time Source #
The original offset of the given Event
data TConnection Source #
Instances
Eq TConnection Source # | |
Defined in Sound.Tidal.Tempo (==) :: TConnection -> TConnection -> Bool # (/=) :: TConnection -> TConnection -> Bool # |
data ServerMode Source #
Instances
Show ServerMode Source # | |
Defined in Sound.Tidal.Tempo showsPrec :: Int -> ServerMode -> ShowS # show :: ServerMode -> String # showList :: [ServerMode] -> ShowS # |
type ClientState = [TConnection] Source #
wsConn :: TConnection -> Connection Source #
getLatency :: IO Double Source #
getClockIp :: IO String Source #
getServerPort :: IO Int Source #
getMasterPort :: IO Int Source #
getSlavePort :: IO Int Source #
removeClient :: TConnection -> ClientState -> ClientState Source #
startServer :: IO ThreadId Source #
serverApp :: MVar Tempo -> MVar ServerMode -> MVar ClientState -> ServerApp Source #
slave :: MVar ServerMode -> MVar ClientState -> IO () Source #
slaveAct :: String -> MVar ServerMode -> MVar ClientState -> Message -> IO () Source #
serverLoop :: TConnection -> MVar Tempo -> MVar ServerMode -> MVar ClientState -> IO () Source #
serverAct :: String -> ServerMode -> MVar Tempo -> MVar ClientState -> IO () Source #
setCps :: Double -> ServerMode -> MVar Tempo -> MVar ClientState -> IO () Source #
setNudge :: Double -> ServerMode -> MVar Tempo -> MVar ClientState -> IO () Source #
The pattern datatype, a function from a time Arc
to Event
values. For discrete patterns, this returns the events which are
active during that time. For continuous patterns, events with
values for the midpoint of the given Arc
is returned.
Instances
showTime :: (Show a, Integral a) => Ratio a -> String Source #
converts a ratio into human readable string, e.g. 1/3
showEvent :: Show a => Event a -> String Source #
converts an event into human readable string, e.g. ("bd" 14 23)
withQueryArc :: (Arc -> Arc) -> Pattern a -> Pattern a Source #
withQueryArc f p
returns a new Pattern
with function f
applied to the Arc
values passed to the original Pattern
p
.
withQueryTime :: (Time -> Time) -> Pattern a -> Pattern a Source #
withQueryTime f p
returns a new Pattern
with function f
applied to the both the start and end Time
of the Arc
passed to
Pattern
p
.
withResultArc :: (Arc -> Arc) -> Pattern a -> Pattern a Source #
withResultArc f p
returns a new Pattern
with function f
applied to the Arc
values in the events returned from the
original Pattern
p
.
withResultTime :: (Time -> Time) -> Pattern a -> Pattern a Source #
withResultTime f p
returns a new Pattern
with function f
applied to the both the start and end Time
of the Arc
values in
the events returned from the original Pattern
p
.
withEvent :: (Event a -> Event b) -> Pattern a -> Pattern b Source #
withEvent f p
returns a new Pattern
with events mapped over
function f
.
timedValues :: Pattern a -> Pattern (Arc, a) Source #
timedValues p
returns a new Pattern
where values are turned
into tuples of Arc
and value.
overlay :: Pattern a -> Pattern a -> Pattern a Source #
overlay
combines two Pattern
s into a new pattern, so that
their events are combined over time. This is the same as the infix
operator <>
.
stack :: [Pattern a] -> Pattern a Source #
stack
combines a list of Pattern
s into a new pattern, so that
their events are combined over time.
append :: Pattern a -> Pattern a -> Pattern a Source #
append
combines two patterns Pattern
s into a new pattern, so
that the events of the second pattern are appended to those of the
first pattern, within a single cycle
append' :: Pattern a -> Pattern a -> Pattern a Source #
append'
does the same as append
, but over two cycles, so that
the cycles alternate between the two patterns.
fastcat :: [Pattern a] -> Pattern a Source #
fastcat
returns a new pattern which interlaces the cycles of the
given patterns, within a single cycle. It's the equivalent of
append
, but with a list of patterns.
splitAtSam :: Pattern a -> Pattern a Source #
slowcat :: [Pattern a] -> Pattern a Source #
slowcat
does the same as fastcat
, but maintaining the duration of
the original patterns. It is the equivalent of append'
, but with
a list of patterns.
listToPat :: [a] -> Pattern a Source #
listToPat
turns the given list of values to a Pattern, which
cycles through the list.
maybeListToPat :: [Maybe a] -> Pattern a Source #
maybeListToPat
is similar to listToPat
, but allows values to
be optional using the Maybe
type, so that Nothing
results in
gaps in the pattern.
run :: (Enum a, Num a) => Pattern a -> Pattern a Source #
run
n
returns a pattern representing a cycle of numbers from 0
to n-1
.
temporalParam2 :: (a -> b -> Pattern c -> Pattern d) -> Pattern a -> Pattern b -> Pattern c -> Pattern d Source #
temporalParam3 :: (a -> b -> c -> Pattern d -> Pattern e) -> Pattern a -> Pattern b -> Pattern c -> Pattern d -> Pattern e Source #
temporalParam2' :: (a -> b -> Pattern c -> Pattern d) -> Pattern a -> Pattern b -> Pattern c -> Pattern d Source #
temporalParam3' :: (a -> b -> c -> Pattern d -> Pattern e) -> Pattern a -> Pattern b -> Pattern c -> Pattern d -> Pattern e Source #
fast :: Pattern Time -> Pattern a -> Pattern a Source #
fast
(also known as density
) returns the given pattern with speed
(or density) increased by the given Time
factor. Therefore fast 2 p
will return a pattern that is twice as fast, and fast (1/3) p
will return one three times as slow.
density :: Pattern Time -> Pattern a -> Pattern a Source #
density
is an alias of fast
. fast
is quicker to type, but
density
is its old name so is used in a lot of examples.
fastGap :: Time -> Pattern a -> Pattern a Source #
fastGap
(also known as densityGap
is similar to fast
but maintains its cyclic
alignment. For example, fastGap 2 p
would squash the events in
pattern p
into the first half of each cycle (and the second
halves would be empty).
slow :: Pattern Time -> Pattern a -> Pattern a Source #
slow
does the opposite of fast
, i.e. slow 2 p
will return a
pattern that is half the speed.
rotL :: Time -> Pattern a -> Pattern a Source #
The <~
operator shifts (or rotates) a pattern to the left (or
counter-clockwise) by the given Time
value. For example
(1%16) <~ p
will return a pattern with all the events moved
one 16th of a cycle to the left.
rotR :: Time -> Pattern a -> Pattern a Source #
The ~>
operator does the same as <~
but shifts events to the
right (or clockwise) rather than to the left.
brak :: Pattern a -> Pattern a Source #
(The above means that brak
is a function from patterns of any type,
to a pattern of the same type.)
Make a pattern sound a bit like a breakbeat
Example:
d1 $ sound (brak "bd sn kurt")
iter :: Pattern Int -> Pattern c -> Pattern c Source #
Divides a pattern into a given number of subdivisions, plays the subdivisions in order, but increments the starting subdivision each cycle. The pattern wraps to the first subdivision after the last subdivision is played.
Example:
d1 $ iter 4 $ sound "bd hh sn cp"
This will produce the following over four cycles:
bd hh sn cp hh sn cp bd sn cp bd hh cp bd hh sn
There is also iter'
, which shifts the pattern in the opposite direction.
iter' :: Pattern Int -> Pattern c -> Pattern c Source #
iter'
is the same as iter
, but decrements the starting
subdivision instead of incrementing it.
rev :: Pattern a -> Pattern a Source #
rev p
returns p
with the event positions in each cycle
reversed (or mirrored).
palindrome :: Pattern a -> Pattern a Source #
palindrome p
applies rev
to p
every other cycle, so that
the pattern alternates between forwards and backwards.
when :: (Int -> Bool) -> (Pattern a -> Pattern a) -> Pattern a -> Pattern a Source #
Only when
the given test function returns True
the given pattern transformation is applied. The test function will be called with the current cycle as a number.
d1 $ when ((elem '4').show) (striate 4) $ sound "hh hc"
The above will only apply `striate 4` to the pattern if the current cycle number contains the number 4. So the fourth cycle will be striated and the fourteenth and so on. Expect lots of striates after cycle number 399.
seqP :: [(Time, Time, Pattern a)] -> Pattern a Source #
The function seqP
allows you to define when
a sound within a list starts and ends. The code below contains three
separate patterns in a stack
, but each has different start times
(zero cycles, eight cycles, and sixteen cycles, respectively). All
patterns stop after 128 cycles:
d1 $ seqP [ (0, 128, sound "bd bd*2"), (8, 128, sound "hh*2 [sn cp] cp future*4"), (16, 128, sound (samples "arpy*8" (run 16))) ]
every :: Pattern Int -> (Pattern a -> Pattern a) -> Pattern a -> Pattern a Source #
every n f p
applies the function f
to p
, but only affects
every n
cycles.
every' :: Pattern Int -> Pattern Int -> (Pattern a -> Pattern a) -> Pattern a -> Pattern a Source #
every n o f'
is like every n f
with an offset of o
cycles
foldEvery :: [Int] -> (Pattern a -> Pattern a) -> Pattern a -> Pattern a Source #
foldEvery ns f p
applies the function f
to p
, and is applied for
each cycle in ns
.
sig :: (Time -> a) -> Pattern a Source #
sig f
takes a function from time to values, and turns it into a
Pattern
.
sinewave :: Fractional a => Pattern a Source #
sinewave
returns a Pattern
of continuous Fractional
values following a
sinewave with frequency of one cycle, and amplitude from 0 to 1.
sine :: Fractional a => Pattern a Source #
sine
is a synonym for sinewave
.
cosine :: Fractional a => Pattern a Source #
sine
is a synonym for 0.25 ~> sine
.
sineAmp :: Fractional a => a -> Pattern a Source #
sineAmp d
returns sinewave
with its amplitude offset by d
.
Deprecated, as these days you can simply do e.g. (sine + 0.5)
sawwave :: (Fractional a, Real a) => Pattern a Source #
sawwave
is the equivalent of sinewave
for (ascending) sawtooth waves.
triwave :: (Fractional a, Real a) => Pattern a Source #
triwave
is the equivalent of sinewave
for triangular waves.
squarewave :: (Fractional a, Real a) => Pattern a Source #
squarewave1
is the equivalent of sinewave
for square waves.
sinewave1 :: Fractional a => Pattern a Source #
sine1 :: Fractional a => Pattern a Source #
sineAmp1 :: Fractional a => a -> Pattern a Source #
squarewave1 :: (Fractional a, Real a) => Pattern a Source #
envL :: Pattern Double Source #
envL
is a Pattern
of continuous Double
values, representing
a linear interpolation between 0 and 1 during the first cycle, then
staying constant at 1 for all following cycles. Possibly only
useful if you're using something like the retrig function defined
in tidal.el.
spread :: (a -> t -> Pattern b) -> [a] -> t -> Pattern b Source #
(The above is difficult to describe, if you don't understand Haskell, just ignore it and read the below..)
The spread
function allows you to take a pattern transformation
which takes a parameter, such as slow
, and provide several
parameters which are switched between. In other words it spreads
a
function across several values.
Taking a simple high hat loop as an example:
d1 $ sound "ho ho:2 ho:3 hc"
We can slow it down by different amounts, such as by a half:
d1 $ slow 2 $ sound "ho ho:2 ho:3 hc"
Or by four thirds (i.e. speeding it up by a third; `4%3` means four over three):
d1 $ slow (4%3) $ sound "ho ho:2 ho:3 hc"
But if we use spread
, we can make a pattern which alternates between
the two speeds:
d1 $ spread slow [2,4%3] $ sound "ho ho:2 ho:3 hc"
Note that if you pass ($) as the function to spread values over, you can put functions as the list of values. For example:
d1 $ spread ($) [density 2, rev, slow 2, striate 3, (# speed "0.8")] $ sound "[bd*2 [~ bd]] [sn future]*2 cp jvbass*4"
Above, the pattern will have these transforms applied to it, one at a time, per cycle:
- cycle 1: `density 2` - pattern will increase in speed
- cycle 2:
rev
- pattern will be reversed - cycle 3: `slow 2` - pattern will decrease in speed
- cycle 4: `striate 3` - pattern will be granualized
- cycle 5: `(# speed "0.8")` - pattern samples will be played back more slowly
After `(# speed "0.8")`, the transforms will repeat and start at `density 2` again.
slowspread :: (a -> t -> Pattern b) -> [a] -> t -> Pattern b Source #
fastspread :: (a -> t -> Pattern b) -> [a] -> t -> Pattern b Source #
fastspread
works the same as spread
, but the result is squashed into a single cycle. If you gave four values to spread
, then the result would seem to speed up by a factor of four. Compare these two:
d1 $ spread chop [4,64,32,16] $ sound "ho ho:2 ho:3 hc"
d1 $ fastspread chop [4,64,32,16] $ sound "ho ho:2 ho:3 hc"
There is also slowspread
, which is an alias of spread
.
spread' :: Monad m => (a -> b -> m c) -> m a -> b -> m c Source #
There's a version of this function, spread'
(pronounced "spread prime"), which takes a *pattern* of parameters, instead of a list:
d1 $ spread' slow "2 4%3" $ sound "ho ho:2 ho:3 hc"
This is quite a messy area of Tidal - due to a slight difference of
implementation this sounds completely different! One advantage of
using spread'
though is that you can provide polyphonic parameters, e.g.:
d1 $ spread' slow "[2 4%3, 3]" $ sound "ho ho:2 ho:3 hc"
spreadChoose :: (t -> t1 -> Pattern b) -> [t] -> t1 -> Pattern b Source #
`spreadChoose f xs p` is similar to slowspread
but picks values from
xs
at random, rather than cycling through them in order. It has a
shorter alias spreadr
.
filterOnsets :: Pattern a -> Pattern a Source #
filterStartInRange :: Pattern a -> Pattern a Source #
filterOnsetsInRange :: Pattern a -> Pattern a Source #
groupByTime :: [Event a] -> [Event [a]] Source #
ifp :: (Int -> Bool) -> (Pattern a -> Pattern a) -> (Pattern a -> Pattern a) -> Pattern a -> Pattern a Source #
Decide whether to apply one or another function depending on the result of a test function that is passed the current cycle as a number.
d1 $ ifp ((== 0).(flip mod 2)) (striate 4) (# coarse "24 48") $ sound "hh hc"
This will apply `striate 4` for every _even_ cycle and aply `# coarse "24 48"` for every _odd_.
Detail: As you can see the test function is arbitrary and does not rely on anything tidal specific. In fact it uses only plain haskell functionality, that is: it calculates the modulo of 2 of the current cycle which is either 0 (for even cycles) or 1. It then compares this value against 0 and returns the result, which is either True
or False
. This is what the ifp
signature's first part signifies `(Int -> Bool)`, a function that takes a whole number and returns either True
or False
.
rand :: Pattern Double Source #
rand
generates a continuous pattern of (pseudo-)random, floating point numbers between `0` and `1`.
d1 $ sound "bd*8" # pan rand
pans bass drums randomly
d1 $ sound "sn sn ~ sn" # gain rand
makes the snares' randomly loud and quiet.
Numbers coming from this pattern are random, but dependent on time. So if you reset time via `cps (-1)` the random pattern will emit the exact same _random_ numbers again.
In cases where you need two different random patterns, you can shift one of them around to change the time from which the _random_ pattern is read, note the difference:
d1 $ jux (|+| gain rand) $ sound "sn sn ~ sn" # gain rand
and with the juxed version shifted backwards for 1024 cycles:
d1 $ jux (|+| ((1024 <~) $ gain rand)) $ sound "sn sn ~ sn" # gain rand
timeToRand :: RealFrac r => r -> Double Source #
irand :: Num a => Int -> Pattern a Source #
Just like rand
but for whole numbers, `irand n` generates a pattern of (pseudo-) random whole numbers between `0` to `n-1` inclusive. Notably used to pick a random
samples from a folder:
d1 $ n (irand 5) # sound "drum"
choose :: [a] -> Pattern a Source #
Randomly picks an element from the given list
d1 $ sound (samples "xx(3,8)" (tom $ choose ["a", "e", "g", "c"]))
plays a melody randomly choosing one of the four notes "a", "e", "g", "c".
sometimesBy :: Double -> (Pattern a -> Pattern a) -> Pattern a -> Pattern a Source #
Use sometimesBy
to apply a given function "sometimes". For example, the
following code results in `density 2` being applied about 25% of the time:
d1 $ sometimesBy 0.25 (density 2) $ sound "bd*8"
There are some aliases as well:
sometimes = sometimesBy 0.5 often = sometimesBy 0.75 rarely = sometimesBy 0.25 almostNever = sometimesBy 0.1 almostAlways = sometimesBy 0.9
sometimes :: (Pattern a -> Pattern a) -> Pattern a -> Pattern a Source #
sometimes
is an alias for sometimesBy 0.5.
often :: (Pattern a -> Pattern a) -> Pattern a -> Pattern a Source #
often
is an alias for sometimesBy 0.75.
rarely :: (Pattern a -> Pattern a) -> Pattern a -> Pattern a Source #
rarely
is an alias for sometimesBy 0.25.
almostNever :: (Pattern a -> Pattern a) -> Pattern a -> Pattern a Source #
almostNever
is an alias for sometimesBy 0.1
almostAlways :: (Pattern a -> Pattern a) -> Pattern a -> Pattern a Source #
almostAlways
is an alias for sometimesBy 0.9
someCyclesBy :: Double -> (Pattern a -> Pattern a) -> Pattern a -> Pattern a Source #
someCyclesBy
is a cycle-by-cycle version of sometimesBy
. It has a
`someCycles = someCyclesBy 0.5` alias
degrade :: Pattern a -> Pattern a Source #
degrade
randomly removes events from a pattern 50% of the time:
d1 $ slow 2 $ degrade $ sound "[[[feel:5*8,feel*3] feel:3*8], feel*4]" # accelerate "-6" # speed "2"
The shorthand syntax for degrade
is a question mark: ?
. Using ?
will allow you to randomly remove events from a portion of a pattern:
d1 $ slow 2 $ sound "bd ~ sn bd ~ bd? [sn bd?] ~"
You can also use ?
to randomly remove events from entire sub-patterns:
d1 $ slow 2 $ sound "[[[feel:5*8,feel*3] feel:3*8]?, feel*4]"
wedge :: Time -> Pattern a -> Pattern a -> Pattern a Source #
wedge t p p'
combines patterns p
and p'
by squashing the
p
into the portion of each cycle given by t
, and p'
into the
remainer of each cycle.
whenmod :: Int -> Int -> (Pattern a -> Pattern a) -> Pattern a -> Pattern a Source #
whenmod
has a similar form and behavior to every
, but requires an
additional number. Applies the function to the pattern, when the
remainder of the current loop number divided by the first parameter,
is greater or equal than the second parameter.
For example the following makes every other block of four loops twice as dense:
d1 $ whenmod 8 4 (density 2) (sound "bd sn kurt")
superimpose :: (Pattern a -> Pattern a) -> Pattern a -> Pattern a Source #
superimpose f p = stack [p, f p]
superimpose
plays a modified version of a pattern at the same time as the original pattern,
resulting in two patterns being played at the same time.
d1 $ superimpose (density 2) $ sound "bd sn [cp ht] hh" d1 $ superimpose ((# speed "2") . (0.125 <~)) $ sound "bd sn cp hh"
splitQueries :: Pattern a -> Pattern a Source #
splitQueries p
wraps p
to ensure that it does not get
queries that span arcs. For example `arc p (0.5, 1.5)` would be
turned into two queries, `(0.5,1)` and `(1,1.5)`, and the results
combined. Being able to assume queries don't span cycles often
makes transformations easier to specify.
trunc :: Pattern Time -> Pattern a -> Pattern a Source #
trunc
truncates a pattern so that only a fraction of the pattern is played.
The following example plays only the first quarter of the pattern:
d1 $ trunc 0.25 $ sound "bd sn*2 cp hh*4 arpy bd*2 cp bd*2"
linger :: Pattern Time -> Pattern a -> Pattern a Source #
linger
is similar to trunc
but the truncated part of the pattern loops until the end of the cycle
d1 $ linger 0.25 $ sound "bd sn*2 cp hh*4 arpy bd*2 cp bd*2"
zoom :: Arc -> Pattern a -> Pattern a Source #
Plays a portion of a pattern, specified by a beginning and end arc of time. The new resulting pattern is played over the time period of the original pattern:
d1 $ zoom (0.25, 0.75) $ sound "bd*2 hh*3 [sn bd]*2 drum"
In the pattern above, zoom
is used with an arc from 25% to 75%. It is equivalent to this pattern:
d1 $ sound "hh*3 [sn bd]*2"
within :: Arc -> (Pattern a -> Pattern a) -> Pattern a -> Pattern a Source #
Use within
to apply a function to only a part of a pattern. For example, to
apply `density 2` to only the first half of a pattern:
d1 $ within (0, 0.5) (density 2) $ sound "bd*2 sn lt mt hh hh hh hh"
Or, to apply `(# speed "0.5") to only the last quarter of a pattern:
d1 $ within (0.75, 1) (# speed "0.5") $ sound "bd*2 sn lt mt hh hh hh hh"
within' :: Arc -> (Pattern a -> Pattern a) -> Pattern a -> Pattern a Source #
For many cases, within'
will function exactly as within.
The difference between the two occurs when applying functions that change the timing of notes such as fast
or <~
.
within first applies the function to all notes in the cycle, then keeps the results in the specified interval, and then combines it with the old cycle (an "apply split combine" paradigm).
within' first keeps notes in the specified interval, then applies the function to these notes, and then combines it with the old cycle (a "split apply combine" paradigm).
For example, whereas using the standard version of within
d1 $ within (0, 0.25) (fast 2) $ sound "bd hh cp sd"
sounds like:
d1 $ sound "[bd hh] hh cp sd"
using this alternative version, within'
d1 $ within' (0, 0.25) (fast 2) $ sound "bd hh cp sd"
sounds like:
d1 $ sound "[bd bd] hh cp sd"
e :: Pattern Int -> Pattern Int -> Pattern a -> Pattern a Source #
You can use the e
function to apply a Euclidean algorithm over a
complex pattern, although the structure of that pattern will be lost:
d1 $ e 3 8 $ sound "bd*2 [sn cp]"
In the above, three sounds are picked from the pattern on the right according
to the structure given by the `e 3 8`. It ends up picking two bd
sounds, a
cp
and missing the sn
entirely.
These types of sequences use "Bjorklund's algorithm", which wasn't made for music but for an application in nuclear physics, which is exciting. More exciting still is that it is very similar in structure to the one of the first known algorithms written in Euclid's book of elements in 300 BC. You can read more about this in the paper [The Euclidean Algorithm Generates Traditional Musical Rhythms](http:/cgm.cs.mcgill.ca~godfriedpublicationsbanff.pdf) by Toussaint. Some examples from this paper are included below, including rotation in some cases.
- (2,5) : A thirteenth century Persian rhythm called Khafif-e-ramal. - (3,4) : The archetypal pattern of the Cumbia from Colombia, as well as a Calypso rhythm from Trinidad. - (3,5,2) : Another thirteenth century Persian rhythm by the name of Khafif-e-ramal, as well as a Rumanian folk-dance rhythm. - (3,7) : A Ruchenitza rhythm used in a Bulgarian folk-dance. - (3,8) : The Cuban tresillo pattern. - (4,7) : Another Ruchenitza Bulgarian folk-dance rhythm. - (4,9) : The Aksak rhythm of Turkey. - (4,11) : The metric pattern used by Frank Zappa in his piece titled Outside Now. - (5,6) : Yields the York-Samai pattern, a popular Arab rhythm. - (5,7) : The Nawakhat pattern, another popular Arab rhythm. - (5,8) : The Cuban cinquillo pattern. - (5,9) : A popular Arab rhythm called Agsag-Samai. - (5,11) : The metric pattern used by Moussorgsky in Pictures at an Exhibition. - (5,12) : The Venda clapping pattern of a South African children’s song. - (5,16) : The Bossa-Nova rhythm necklace of Brazil. - (7,8) : A typical rhythm played on the Bendir (frame drum). - (7,12) : A common West African bell pattern. - (7,16,14) : A Samba rhythm necklace from Brazil. - (9,16) : A rhythm necklace used in the Central African Republic. - (11,24,14) : A rhythm necklace of the Aka Pygmies of Central Africa. - (13,24,5) : Another rhythm necklace of the Aka Pygmies of the upper Sangha.
efull :: Pattern Int -> Pattern Int -> Pattern a -> Pattern a -> Pattern a Source #
`efull n k pa pb` stacks e n k pa
with einv n k pb
prrw :: (a -> b -> c) -> Int -> (Time, Time) -> Pattern a -> Pattern b -> Pattern c Source #
prrw f rot (blen, vlen) beatPattern valuePattern
: pattern rotate/replace.
prr :: Int -> (Time, Time) -> Pattern String -> Pattern b -> Pattern b Source #
prr rot (blen, vlen) beatPattern valuePattern
: pattern rotate/replace.
preplace :: (Time, Time) -> Pattern String -> Pattern b -> Pattern b Source #
preplace (blen, plen) beats values
combines the timing of beats
with the values
of values
. Other ways of saying this are:
* sequential convolution
* values
quantized to beats
.
Examples:
d1 $ sound $ preplace (1,1) "x [~ x] x x" "bd sn" d1 $ sound $ preplace (1,1) "x(3,8)" "bd sn" d1 $ sound $ "x(3,8)" ~ "bd sn" d1 $ sound "[jvbass jvbass:5]*3" |+| (shape $ "1 1 1 1 1" ~ "0.2 0.9")
It is assumed the pattern fits into a single cycle. This works well with
pattern literals, but not always with patterns defined elsewhere. In those cases
use preplace
and provide desired pattern lengths:
@
let p = slow 2 $ "x x x"
d1 $ sound $ preplace (2,1) p "bd sn" @
prep :: (Time, Time) -> Pattern String -> Pattern b -> Pattern b Source #
prep
is an alias for preplace.
protate :: Time -> Int -> Pattern a -> Pattern a Source #
protate len rot p
rotates pattern p
by rot
beats to the left.
len
: length of the pattern, in cycles.
Example: d1 $ every 4 (protate 2 (-1)) $ slow 2 $ sound "bd hh hh hh"
(<<~) :: Int -> Pattern a -> Pattern a Source #
The <<~
operator rotates a unit pattern to the left, similar to <~
,
but by events rather than linear time. The timing of the pattern remains constant:
d1 $ (1 <<~) $ sound "bd ~ sn hh" -- will become d1 $ sound "sn ~ hh bd"
pequal :: Ord a => Time -> Pattern a -> Pattern a -> Bool Source #
pequal cycles p1 p2
: quickly test if p1
and p2
are the same.
discretise :: Time -> Pattern a -> Pattern a Source #
discretise n p
: samples
the pattern p
at a rate of n
events per cycle. Useful for turning a continuous pattern into a
discrete one.
randcat :: [Pattern a] -> Pattern a Source #
randcat ps
: does a slowcat
on the list of patterns ps
but
randomises the order in which they are played.
fit :: Int -> [a] -> Pattern Int -> Pattern a Source #
The fit
function takes a pattern of integer numbers, which are used to select values from the given list. What makes this a bit strange is that only a given number of values are selected each cycle. For example:
d1 $ sound (fit 3 ["bd", "sn", "arpy", "arpy:1", "casio"] "0 [~ 1] 2 1")
The above fits three samples into the pattern, i.e. for the first cycle this will be `"bd"`, `"sn"` and `"arpy"`, giving the result `"bd [~ sn] arpy sn"` (note that we start counting at zero, so that `0` picks the first value). The following cycle the *next* three values in the list will be picked, i.e. `"arpy:1"`, `"casio"` and `"bd"`, giving the pattern `"arpy:1 [~ casio] bd casio"` (note that the list wraps round here).
struct :: Pattern String -> Pattern a -> Pattern a Source #
struct a b
: structures pattern b
in terms of a
.
substruct :: Pattern String -> Pattern b -> Pattern b Source #
substruct a b
: similar to struct
, but each event in pattern a
gets replaced with pattern b
, compressed to fit the timespan of the event.
stripe :: Pattern Int -> Pattern a -> Pattern a Source #
stripe n p
: repeats pattern p
, n
times per cycle. So
similar to fast
, but with random durations. The repetitions will
be continguous (touching, but not overlapping) and the durations
will add up to a single cycle. n
can be supplied as a pattern of
integers.
slowstripe :: Pattern Int -> Pattern a -> Pattern a Source #
slowstripe n p
: The same as stripe
, but the result is also
n
times slower, so that the mean average duration of the stripes
is exactly one cycle, and every n
th stripe starts on a cycle
boundary (in indian classical terms, the sam
).
lindenmayer :: Int -> String -> String -> String Source #
returns the n
th iteration of a Lindenmayer System with given start sequence.
for example:
lindenmayer 1 "a:b,b:ab" "ab" -> "bab"
lindenmayerI :: Num b => Int -> String -> String -> [b] Source #
lindenmayerI
converts the resulting string into a a list of integers
with fromIntegral
applied (so they can be used seamlessly where floats or
rationals are required)
mask :: Pattern a -> Pattern b -> Pattern b Source #
Removes events from second pattern that don't start during an event from first.
Consider this, kind of messy rhythm without any rests.
d1 $ sound (slowcat ["sn*8", "[cp*4 bd*4, hc*5]"]) # n (run 8)
If we apply a mask to it
d1 $ s (mask ("1 1 1 ~ 1 1 ~ 1" :: Pattern Bool) (slowcat ["sn*8", "[cp*4 bd*4, bass*5]"] )) # n (run 8)
Due to the use of slowcat
here, the same mask is first applied to `"sn*8"` and in the next cycle to `"[cp*4 bd*4, hc*5]".
You could achieve the same effect by adding rests within the slowcat
patterns, but mask allows you to do this more easily. It kind of keeps the rhythmic structure and you can change the used samples independently, e.g.
d1 $ s (mask ("1 ~ 1 ~ 1 1 ~ 1" :: Pattern Bool) (slowcat ["can*8", "[cp*4 sn*4, jvbass*16]"] )) # n (run 8)
Detail: It is currently needed to explicitly _tell_ Tidal that the mask itself is a `Pattern Bool` as it cannot infer this by itself, otherwise it will complain as it does not know how to interpret your input.
enclosingArc :: [Arc] -> Arc Source #
fit' :: Pattern Time -> Int -> Pattern Int -> Pattern Int -> Pattern a -> Pattern a Source #
fit'
is a generalization of fit
, where the list is instead constructed by using another integer pattern to slice up a given pattern. The first argument is the number of cycles of that latter pattern to use when slicing. It's easier to understand this with a few examples:
d1 $ sound (fit' 1 2 "0 1" "1 0" "bd sn")
So what does this do? The first `1` just tells it to slice up a single cycle of `"bd sn"`. The `2` tells it to select two values each cycle, just like the first argument to fit
. The next pattern `"0 1"` is the "from" pattern which tells it how to slice, which in this case means `"0"` maps to `"bd"`, and `"1"` maps to `"sn"`. The next pattern `"1 0"` is the "to" pattern, which tells it how to rearrange those slices. So the final result is the pattern `"sn bd"`.
A more useful example might be something like
d1 $ fit' 1 4 (run 4) "[0 3*2 2 1 0 3*2 2 [1*8 ~]]/2" $ chop 4 $ (sound "breaks152" # unit "c")
which uses chop
to break a single sample into individual pieces, which fit'
then puts into a list (using the `run 4` pattern) and reassembles according to the complicated integer pattern.
chunk :: Integer -> (Pattern b -> Pattern b) -> Pattern b -> Pattern b Source #
chunk n f p
treats the given pattern p
as having n
chunks, and applies the function f
to one of those sections per cycle, running from left to right.
d1 $ chunk 4 (density 4) $ sound "cp sn arpy [mt lt]"
chunk' :: Integral a => a -> (Pattern b -> Pattern b) -> Pattern b -> Pattern b Source #
chunk'
works much the same as chunk
, but runs from right to left.
toScale' :: Num a => Int -> [a] -> Pattern Int -> Pattern a Source #
toScale
lets you turn a pattern of notes within a scale (expressed as a
list) to note numbers. For example `toScale [0, 4, 7] "0 1 2 3"` will turn
into the pattern `"0 4 7 12"`. It assumes your scale fits within an octave;
to change this use toScale
size`. Example:
toScale
24 [0,4,7,10,14,17] (run 8)` turns into `"0 4 7 10 14 17 24 28"`
swingBy :: Pattern Time -> Pattern Time -> Pattern a -> Pattern a Source #
`swingBy x n` divides a cycle into n
slices and delays the notes in
the second half of each slice by x
fraction of a slice . swing
is an alias
for `swingBy (1%3)`
cycleChoose :: [a] -> Pattern a Source #
cycleChoose
is like choose
but only picks a new item from the list
once each cycle
shuffle :: Int -> Pattern a -> Pattern a Source #
`shuffle n p` evenly divides one cycle of the pattern p
into n
parts,
and returns a random permutation of the parts each cycle. For example,
`shuffle 3 "a b c"` could return `"a b c"`, `"a c b"`, `"b a c"`, `"b c a"`,
`"c a b"`, or `"c b a"`. But it will **never** return `"a a a"`, because that
is not a permutation of the parts.
scramble :: Int -> Pattern a -> Pattern a Source #
`scramble n p` is like shuffle
but randomly selects from the parts
of p
instead of making permutations.
For example, `scramble 3 "a b c"` will randomly select 3 parts from
`"a"` `"b"` and `"c"`, possibly repeating a single part.
ur :: Time -> Pattern String -> [(String, Pattern a)] -> [(String, Pattern a -> Pattern a)] -> Pattern a Source #
spaceOut :: [Time] -> Pattern a -> Pattern a Source #
spaceOut xs p
repeats a pattern p
at different durations given by the list of time values in xs
flatpat :: Pattern [a] -> Pattern a Source #
flatpat
takes a Pattern of lists and pulls the list elements as
separate Events
layer :: [a -> Pattern b] -> a -> Pattern b Source #
layer
takes a Pattern of lists and pulls the list elements as
separate Events
breakUp :: Pattern a -> Pattern a Source #
breakUp
finds events that share the same timespan, and spreads them out during that timespan, so for example breakUp "[bd,sn]"
gets turned into "bd sn"
fill :: Pattern a -> Pattern a -> Pattern a Source #
fill
'fills in' gaps in one pattern with events from another. For example fill "bd" "cp ~ cp"
would result in the equivalent of `"~ bd ~"`. This only finds gaps in a resulting pattern, in other words "[bd ~, sn]"
doesn't contain any gaps (because sn
covers it all), and "bd ~ ~ sn"
only contains a single gap that bridges two steps.
class Enumerable a where Source #
AST representation of patterns
TPat_Atom a | |
TPat_Density (TPat Time) (TPat a) | |
TPat_Slow (TPat Time) (TPat a) | |
TPat_Zoom Arc (TPat a) | |
TPat_DegradeBy Double (TPat a) | |
TPat_Silence | |
TPat_Foot | |
TPat_Elongate Int | |
TPat_EnumFromTo (TPat a) (TPat a) | |
TPat_Cat [TPat a] | |
TPat_TimeCat [TPat a] | |
TPat_Overlay (TPat a) (TPat a) | |
TPat_ShiftL Time (TPat a) | |
TPat_pE (TPat Int) (TPat Int) (TPat Integer) (TPat a) |
parseIntNote :: Integral i => Parser i Source #
type ParamPattern = Pattern ParamMap Source #
ticksPerCycle :: Num p => p Source #
defaultValue :: Param -> Value Source #
hasDefault :: Param -> Bool Source #
defaultMap :: Shape -> ParamMap Source #
state :: Backend a -> Shape -> IO (MVar (ParamPattern, [ParamPattern])) Source #
streamcallback :: (ParamPattern -> IO ()) -> Backend a -> Shape -> IO (ParamPattern -> IO ()) Source #
onTick' :: Backend a -> Shape -> MVar (ParamPattern, [ParamPattern]) -> Tempo -> Int -> IO () Source #
merge :: ParamPattern -> ParamPattern -> ParamPattern Source #
(|=|) :: ParamPattern -> ParamPattern -> ParamPattern infixl 1 Source #
(#) :: ParamPattern -> ParamPattern -> ParamPattern infixl 1 Source #
mergeWith :: (Ord k, Applicative f) => (k -> a -> a -> a) -> f (Map k a) -> f (Map k a) -> f (Map k a) Source #
mergeNumWith :: Applicative f => (Int -> Int -> Int) -> (Double -> Double -> Double) -> f (Map Param Value) -> f (Map Param Value) -> f (Map Param Value) Source #
mergePlus :: Applicative f => f (Map Param Value) -> f (Map Param Value) -> f (Map Param Value) Source #
(|*|) :: ParamPattern -> ParamPattern -> ParamPattern infixl 1 Source #
(|+|) :: ParamPattern -> ParamPattern -> ParamPattern infixl 1 Source #
(|-|) :: ParamPattern -> ParamPattern -> ParamPattern infixl 1 Source #
(|/|) :: ParamPattern -> ParamPattern -> ParamPattern infixl 1 Source #
(###) :: Foldable t => ParamPattern -> t ParamPattern -> ParamPattern Source #
These are shorthand for merging lists of patterns with #
, |*|
, |+|
,
or |/|
. Sometimes this saves a little typing and can improve readability
when passing things into other functions. As an example, instead of writing
d1 $ sometimes ((|*| speed "2") . (|*| cutoff "2") . (|*| shape "1.5")) $ sound "arpy*4" shape "0.3"
you can write
d1 $ sometimes (*** [speed "2", cutoff "2", shape "1.5"]) $ sound "arpy*4" ### [cutoff "350", shape "0.3"]
(***) :: Foldable t => ParamPattern -> t ParamPattern -> ParamPattern Source #
(+++) :: Foldable t => ParamPattern -> t ParamPattern -> ParamPattern Source #
(///) :: Foldable t => ParamPattern -> t ParamPattern -> ParamPattern Source #
copyParam :: Param -> Param -> ParamPattern -> ParamPattern Source #
Copies values from one parameter to another. Used by nToOrbit
in Sound.Tidal.Dirt
.
with :: ParamType a => Param -> (Pattern a -> Pattern a) -> ParamPattern -> ParamPattern Source #
withI :: Param -> (Pattern Int -> Pattern Int) -> ParamPattern -> ParamPattern Source #
withF :: Param -> (Pattern Double -> Pattern Double) -> ParamPattern -> ParamPattern Source #
withS :: Param -> (Pattern String -> Pattern String) -> ParamPattern -> ParamPattern Source #
follow :: (ParamType a, ParamType b) => Param -> Param -> (Pattern a -> Pattern b) -> ParamPattern -> ParamPattern Source #
follow' :: ParamType a => Param -> Param -> (Pattern a -> Pattern a) -> ParamPattern -> ParamPattern Source #
followF :: Param -> Param -> (Pattern Double -> Pattern Double) -> ParamPattern -> ParamPattern Source #
followS :: Param -> Param -> (Pattern String -> Pattern String) -> ParamPattern -> ParamPattern Source #
coerce :: Param -> ParamPattern -> ParamPattern Source #
chord :: Num a => Pattern String -> Pattern a Source #
chord p
turns a pattern of chord names into a pattern of
numbers, representing note value offsets for the chords
sound :: Pattern String -> ParamPattern Source #
A pattern of strings representing sounds or synth notes.
Internally, sound
or its shorter alias s
is a combination of the samplebank name and number when used with samples, or synth name and note number when used with a synthesiser. For example `bd:2` specifies the third sample (not the second as you might expect, because we start counting at zero) in the bd
sample folder.
- Internally,
sound
/s
is a combination of two parameters, the hidden parameters'
which specifies the samplebank or synth, and then
parameter which specifies the sample or note number. For example:
d1 $ sound "bd:2 sn:0"
is essentially the same as:
d1 $ s' "bd sn" # n "2 0"
n
is therefore useful when you want to pattern the sample or note
number separately from the samplebank or synth. For example:
d1 $ n "0 5 ~ 2" # sound "drum"
is equivalent to:
d1 $ sound "drum:0 drum:5 ~ drum:2"
accelerate :: Pattern Double -> ParamPattern Source #
a pattern of numbers that speed up (or slow down) samples while they play.
accelerate_p :: Param Source #
attack :: Pattern Double -> ParamPattern Source #
a pattern of numbers to specify the attack time (in seconds) of an envelope applied to each sample. Only takes effect if release
is also specified.
bandf :: Pattern Double -> ParamPattern Source #
a pattern of numbers from 0 to 1. Sets the center frequency of the band-pass filter.
bandq :: Pattern Double -> ParamPattern Source #
a pattern of numbers from 0 to 1. Sets the q-factor of the band-pass filter.y
a pattern of numbers from 0 to 1. Skips the beginning of each sample, e.g. `0.25` to cut off the first quarter from each sample.
Using `begin "-1"` combined with `cut "-1"` means that when the sample cuts itself it will begin playback from where the previous one left off, so it will sound like one seamless sample. This allows you to apply a synth param across a long sample in a way similar to chop
:
cps 0.5 d1 $ sound "breaks125*8" begin "-1" coarse "1 2 4 8 16 32 64 128"
This will play the breaks125
sample and apply the changing coarse
parameter over the sample. Compare to:
d1 $ (chop 8 $ sounds "breaks125") coarse "1 2 4 8 16 32 64 128"
which performs a similar effect, but due to differences in implementation sounds different.
channel :: Pattern Int -> ParamPattern Source #
choose the physical channel the pattern is sent to, this is super dirt specific
a pattern of numbers from 0 to 1. Skips the beginning of each sample, e.g. `0.25` to cut off the first quarter from each sample.
Using `begin "-1"` combined with `cut "-1"` means that when the sample cuts itself it will begin playback from where the previous one left off, so it will sound like one seamless sample. This allows you to apply a synth param across a long sample in a way similar to chop
:
cps 0.5 d1 $ sound "breaks125*8" begin "-1" coarse "1 2 4 8 16 32 64 128"
This will play the breaks125
sample and apply the changing coarse
parameter over the sample. Compare to:
d1 $ (chop 8 $ sounds "breaks125") coarse "1 2 4 8 16 32 64 128"
which performs a similar effect, but due to differences in implementation sounds different.
a pattern of numbers from 0 to 1. Skips the beginning of each sample, e.g. `0.25` to cut off the first quarter from each sample.
Using `begin "-1"` combined with `cut "-1"` means that when the sample cuts itself it will begin playback from where the previous one left off, so it will sound like one seamless sample. This allows you to apply a synth param across a long sample in a way similar to chop
:
cps 0.5 d1 $ sound "breaks125*8" begin "-1" coarse "1 2 4 8 16 32 64 128"
This will play the breaks125
sample and apply the changing coarse
parameter over the sample. Compare to:
d1 $ (chop 8 $ sounds "breaks125") coarse "1 2 4 8 16 32 64 128"
which performs a similar effect, but due to differences in implementation sounds different.
clhatdecay :: Pattern Double -> ParamPattern Source #
clhatdecay_p :: Param Source #
a pattern of numbers from 0 to 1. Skips the beginning of each sample, e.g. `0.25` to cut off the first quarter from each sample.
Using `begin "-1"` combined with `cut "-1"` means that when the sample cuts itself it will begin playback from where the previous one left off, so it will sound like one seamless sample. This allows you to apply a synth param across a long sample in a way similar to chop
:
cps 0.5 d1 $ sound "breaks125*8" begin "-1" coarse "1 2 4 8 16 32 64 128"
This will play the breaks125
sample and apply the changing coarse
parameter over the sample. Compare to:
d1 $ (chop 8 $ sounds "breaks125") coarse "1 2 4 8 16 32 64 128"
which performs a similar effect, but due to differences in implementation sounds different.
coarse :: Pattern Int -> ParamPattern Source #
fake-resampling, a pattern of numbers for lowering the sample rate, i.e. 1 for original 2 for half, 3 for a third and so on.
a pattern of numbers from 0 to 1. Skips the beginning of each sample, e.g. `0.25` to cut off the first quarter from each sample.
Using `begin "-1"` combined with `cut "-1"` means that when the sample cuts itself it will begin playback from where the previous one left off, so it will sound like one seamless sample. This allows you to apply a synth param across a long sample in a way similar to chop
:
cps 0.5 d1 $ sound "breaks125*8" begin "-1" coarse "1 2 4 8 16 32 64 128"
This will play the breaks125
sample and apply the changing coarse
parameter over the sample. Compare to:
d1 $ (chop 8 $ sounds "breaks125") coarse "1 2 4 8 16 32 64 128"
which performs a similar effect, but due to differences in implementation sounds different.
crush :: Pattern Double -> ParamPattern Source #
bit crushing, a pattern of numbers from 1 (for drastic reduction in bit-depth) to 16 (for barely no reduction).
a pattern of numbers from 0 to 1. Skips the beginning of each sample, e.g. `0.25` to cut off the first quarter from each sample.
Using `begin "-1"` combined with `cut "-1"` means that when the sample cuts itself it will begin playback from where the previous one left off, so it will sound like one seamless sample. This allows you to apply a synth param across a long sample in a way similar to chop
:
cps 0.5 d1 $ sound "breaks125*8" begin "-1" coarse "1 2 4 8 16 32 64 128"
This will play the breaks125
sample and apply the changing coarse
parameter over the sample. Compare to:
d1 $ (chop 8 $ sounds "breaks125") coarse "1 2 4 8 16 32 64 128"
which performs a similar effect, but due to differences in implementation sounds different.
cut :: Pattern Int -> ParamPattern Source #
In the style of classic drum-machines, cut
will stop a playing sample as soon as another samples with in same cutgroup is to be played.
An example would be an open hi-hat followed by a closed one, essentially muting the open.
d1 $ stack [ sound "bd", sound "~ [~ [ho:2 hc/2]]" # cut "1" ]
This will mute the open hi-hat every second cycle when the closed one is played.
Using cut
with negative values will only cut the same sample. This is useful to cut very long samples
d1 $ sound "bev, [ho:3]" # cut "-1"
Using `cut "0"` is effectively _no_ cutgroup.
cutoff :: Pattern Double -> ParamPattern Source #
a pattern of numbers from 0 to 1. Applies the cutoff frequency of the low-pass filter.
cutoffegint :: Pattern Double -> ParamPattern Source #
delay :: Pattern Double -> ParamPattern Source #
a pattern of numbers from 0 to 1. Sets the level of the delay signal.
delayfeedback :: Pattern Double -> ParamPattern Source #
a pattern of numbers from 0 to 1. Sets the amount of delay feedback.
delaytime :: Pattern Double -> ParamPattern Source #
a pattern of numbers from 0 to 1. Sets the length of the delay.
delaytime_p :: Param Source #
gain :: Pattern Double -> ParamPattern Source #
a pattern of numbers that specify volume. Values less than 1 make the sound quieter. Values greater than 1 make the sound louder.
hatgrain_p :: Param Source #
hcutoff :: Pattern Double -> ParamPattern Source #
a pattern of numbers from 0 to 1. Applies the cutoff frequency of the high-pass filter.
hresonance :: Pattern Double -> ParamPattern Source #
a pattern of numbers from 0 to 1. Applies the resonance of the high-pass filter.
hresonance_p :: Param Source #
lfocutoffint :: Pattern Double -> ParamPattern Source #
lfodelay_p :: Param Source #
lfopitchint :: Pattern Double -> ParamPattern Source #
lfoshape_p :: Param Source #
lock :: Pattern Double -> ParamPattern Source #
A pattern of numbers. Specifies whether delaytime is calculated relative to cps. When set to 1, delaytime is a direct multiple of a cycle.
degree :: Pattern Double -> ParamPattern Source #
Pushes things forward (or backwards within built-in latency) in time. Allows for nice things like _swing_ feeling:
d1 $ stack [ sound "bd bd/4", sound "hh(5,8)" ] # nudge "[0 0.04]*4"
- -pitch model
mtranspose :: Pattern Double -> ParamPattern Source #
Pushes things forward (or backwards within built-in latency) in time. Allows for nice things like _swing_ feeling:
d1 $ stack [ sound "bd bd/4", sound "hh(5,8)" ] # nudge "[0 0.04]*4"
- -pitch model
mtranspose_p :: Param Source #
ctranspose :: Pattern Double -> ParamPattern Source #
Pushes things forward (or backwards within built-in latency) in time. Allows for nice things like _swing_ feeling:
d1 $ stack [ sound "bd bd/4", sound "hh(5,8)" ] # nudge "[0 0.04]*4"
- -pitch model
ctranspose_p :: Param Source #
harmonic :: Pattern Double -> ParamPattern Source #
Pushes things forward (or backwards within built-in latency) in time. Allows for nice things like _swing_ feeling:
d1 $ stack [ sound "bd bd/4", sound "hh(5,8)" ] # nudge "[0 0.04]*4"
- -pitch model
harmonic_p :: Param Source #
stepsPerOctave :: Pattern Double -> ParamPattern Source #
Pushes things forward (or backwards within built-in latency) in time. Allows for nice things like _swing_ feeling:
d1 $ stack [ sound "bd bd/4", sound "hh(5,8)" ] # nudge "[0 0.04]*4"
- -pitch model
octaveRatio :: Pattern Double -> ParamPattern Source #
Pushes things forward (or backwards within built-in latency) in time. Allows for nice things like _swing_ feeling:
d1 $ stack [ sound "bd bd/4", sound "hh(5,8)" ] # nudge "[0 0.04]*4"
- -pitch model
ophatdecay :: Pattern Double -> ParamPattern Source #
ophatdecay_p :: Param Source #
orbit :: Pattern Int -> ParamPattern Source #
a pattern of numbers. An orbit
is a global parameter context for patterns. Patterns with the same orbit will share hardware output bus offset and global effects, e.g. reverb and delay. The maximum number of orbits is specified in the superdirt startup, numbers higher than maximum will wrap around.
pan :: Pattern Double -> ParamPattern Source #
a pattern of numbers between 0 and 1, from left to right (assuming stereo), once round a circle (assuming multichannel)
panspan :: Pattern Double -> ParamPattern Source #
a pattern of numbers between -inf and inf, which controls how much multichannel output is fanned out (negative is backwards ordering)
pansplay :: Pattern Double -> ParamPattern Source #
a pattern of numbers between 0.0 and 1.0, which controls the multichannel spread range (multichannel only)
pansplay_p :: Param Source #
panwidth :: Pattern Double -> ParamPattern Source #
a pattern of numbers between 0.0 and inf, which controls how much each channel is distributed over neighbours (multichannel only)
panwidth_p :: Param Source #
panorient :: Pattern Double -> ParamPattern Source #
a pattern of numbers between -1.0 and 1.0, which controls the relative position of the centre pan in a pair of adjacent speakers (multichannel only)
panorient_p :: Param Source #
portamento :: Pattern Double -> ParamPattern Source #
portamento_p :: Param Source #
release :: Pattern Double -> ParamPattern Source #
a pattern of numbers to specify the release time (in seconds) of an envelope applied to each sample. Only takes effect if attack
is also specified.
resonance :: Pattern Double -> ParamPattern Source #
a pattern of numbers from 0 to 1. Specifies the resonance of the low-pass filter.
resonance_p :: Param Source #
room :: Pattern Double -> ParamPattern Source #
a pattern of numbers from 0 to 1. Sets the level of reverb.
semitone_p :: Param Source #
shape :: Pattern Double -> ParamPattern Source #
wave shaping distortion, a pattern of numbers from 0 for no distortion up to 1 for loads of distortion.
size :: Pattern Double -> ParamPattern Source #
a pattern of numbers from 0 to 1. Sets the perceptual size (reverb time) of the room
to be used in reverb.
speed :: Pattern Double -> ParamPattern Source #
a pattern of numbers which changes the speed of sample playback, i.e. a cheap way of changing pitch. Negative values will play the sample backwards!
stutterdepth :: Pattern Double -> ParamPattern Source #
stuttertime :: Pattern Double -> ParamPattern Source #
tomdecay_p :: Param Source #
unit :: Pattern String -> ParamPattern Source #
used in conjunction with speed
, accepts values of "r" (rate, default behavior), "c" (cycles), or "s" (seconds).
Using `unit "c"` means speed
will be interpreted in units of cycles, e.g. `speed "1"` means samples will be stretched to fill a cycle.
Using `unit "s"` means the playback speed will be adjusted so that the duration is the number of seconds specified by speed
.
velocity_p :: Param Source #
vcfegint_p :: Param Source #
vcoegint_p :: Param Source #
vowel :: Pattern String -> ParamPattern Source #
formant filter to make things sound like vowels, a pattern of either a
, e
, i
, o
or u
. Use a rest (`~`) for no effect.
modwheel_p :: Param Source #
expression :: Pattern Double -> ParamPattern Source #
expression_p :: Param Source #
sustainpedal :: Pattern Double -> ParamPattern Source #
tremolorate :: Pattern Double -> ParamPattern Source #
tremolodepth :: Pattern Double -> ParamPattern Source #
phaserrate :: Pattern Double -> ParamPattern Source #
phaserrate_p :: Param Source #
phaserdepth :: Pattern Double -> ParamPattern Source #
midichan_p :: Param Source #
frameRate_p :: Param Source #
transition :: IO Time -> MVar (ParamPattern, [ParamPattern]) -> (Time -> [ParamPattern] -> ParamPattern) -> ParamPattern -> IO () Source #
histpan :: Int -> Time -> [ParamPattern] -> ParamPattern Source #
Pans the last n versions of the pattern across the field
superwash :: (Pattern a -> Pattern a) -> (Pattern a -> Pattern a) -> Time -> Time -> Time -> Time -> [Pattern a] -> Pattern a Source #
A generalization of wash
. Washes away the current pattern after a certain delay by applying a function to it over time, then switching over to the next pattern to which another function is applied.
wash :: (Pattern a -> Pattern a) -> Time -> Time -> [Pattern a] -> Pattern a Source #
Wash away the current pattern by applying a function to it over time, then switching over to the next.
d1 $ sound "feel ! feel:1 feel:2" t1 (wash (chop 8) 4) $ sound "feel*4 [feel:2 sn:2]"
Note that `chop 8` is applied to `sound "feel ! feel:1 feel:2"` for 4 cycles and then the whole pattern is replaced by `sound "feel*4 [feel:2 sn:2]`
wait :: Time -> Time -> [ParamPattern] -> ParamPattern Source #
Just stop for a bit before playing new pattern
wait' :: (Time -> [ParamPattern] -> ParamPattern) -> Time -> Time -> [ParamPattern] -> ParamPattern Source #
jump :: Time -> [ParamPattern] -> ParamPattern Source #
jumpIn :: Int -> Time -> [ParamPattern] -> ParamPattern Source #
Sharp jump
transition after the specified number of cycles have passed.
t1 (jumpIn 2) $ sound "kick(3,8)"
jumpIn' :: Int -> Time -> [ParamPattern] -> ParamPattern Source #
jumpMod :: Int -> Time -> [ParamPattern] -> ParamPattern Source #
Sharp jump
transition at next cycle boundary where cycle mod n == 0
mortal :: Time -> Time -> Time -> [ParamPattern] -> ParamPattern Source #
Degrade the new pattern over time until it ends in silence
interpolateIn :: Time -> Time -> [ParamPattern] -> ParamPattern Source #
superDirtState :: Int -> IO (MVar (ParamPattern, [ParamPattern])) Source #
dirtBackend :: IO (Backend a) Source #
dirtStream :: IO (ParamPattern -> IO ()) Source #
dirtState :: IO (MVar (ParamPattern, [ParamPattern])) Source #
dirtSetters :: IO Time -> IO (ParamPattern -> IO (), (Time -> [ParamPattern] -> ParamPattern) -> ParamPattern -> IO ()) Source #
superDirtSetters :: IO Time -> IO (ParamPattern -> IO (), (Time -> [ParamPattern] -> ParamPattern) -> ParamPattern -> IO ()) Source #
superDirts :: [Int] -> IO [(ParamPattern -> IO (), (Time -> [ParamPattern] -> ParamPattern) -> ParamPattern -> IO ())] Source #
dirtstream :: p -> IO (ParamPattern -> IO ()) Source #
showToColour :: Show a => a -> ColourD Source #
datumToColour :: Value -> ColourD Source #
stringToColour :: String -> ColourD Source #
striate :: Pattern Int -> ParamPattern -> ParamPattern Source #
Striate is a kind of granulator, for example:
d1 $ striate 3 $ sound "ho ho:2 ho:3 hc"
This plays the loop the given number of times, but triggering progressive portions of each sample. So in this case it plays the loop three times, the first time playing the first third of each sample, then the second time playing the second third of each sample, etc.. With the highhat samples in the above example it sounds a bit like reverb, but it isn't really.
You can also use striate with very long samples, to cut it into short chunks and pattern those chunks. This is where things get towards granular synthesis. The following cuts a sample into 128 parts, plays it over 8 cycles and manipulates those parts by reversing and rotating the loops.
d1 $ slow 8 $ striate 128 $ sound "bev"
_striate :: Int -> ParamPattern -> ParamPattern Source #
striate' :: Pattern Int -> Pattern Double -> ParamPattern -> ParamPattern Source #
The striate'
function is a variant of striate
with an extra
parameter, which specifies the length of each part. The striate'
function still scans across the sample over a single cycle, but if
each bit is longer, it creates a sort of stuttering effect. For
example the following will cut the bev sample into 32 parts, but each
will be 1/16th of a sample long:
d1 $ slow 32 $ striate' 32 (1/16) $ sound "bev"
Note that striate
uses the begin
and end
parameters
internally. This means that if you're using striate
(or striate'
)
you probably shouldn't also specify begin
or end
.
_striate' :: Int -> Double -> ParamPattern -> ParamPattern Source #
striateO :: Pattern Int -> Pattern Double -> ParamPattern -> ParamPattern Source #
like striate
, but with an offset to the begin and end values
_striateO :: Int -> Double -> ParamPattern -> ParamPattern Source #
striateL :: Pattern Int -> Pattern Int -> ParamPattern -> ParamPattern Source #
Just like striate
, but also loops each sample chunk a number of times specified in the second argument.
The primed version is just like striate'
, where the loop count is the third argument. For example:
d1 $ striateL' 3 0.125 4 $ sound "feel sn:2"
Like striate
, these use the begin
and end
parameters internally, as well as the loop
parameter for these versions.
_striateL :: Int -> Int -> ParamPattern -> ParamPattern Source #
_striateL' :: Integral a => Int -> Double -> a -> ParamPattern -> ParamPattern Source #
clutchIn :: Time -> Time -> [Pattern a] -> Pattern a Source #
Also degrades the current pattern and undegrades the next.
To change the number of cycles the transition takes, you can use clutchIn
like so:
d1 $ sound "bd(5,8)" t1 (clutchIn 8) $ sound "[hh*4, odx(3,8)]"
will take 8 cycles for the transition.
clutch :: Time -> [Pattern a] -> Pattern a Source #
Degrades the current pattern while undegrading the next.
This is like xfade
but not by gain of samples but by randomly removing events from the current pattern and slowly adding back in missing events from the next one.
d1 $ sound "bd(3,8)" t1 clutch $ sound "[hh*4, odx(3,8)]"
clutch
takes two cycles for the transition, essentially this is clutchIn 2
.
xfadeIn :: Time -> Time -> [ParamPattern] -> ParamPattern Source #
crossfades between old and new pattern over given number of cycles, e.g.:
d1 $ sound "bd sn" t1 (xfadeIn 16) $ sound "jvbass*3"
Will fade over 16 cycles from "bd sn" to "jvbass*3"
xfade :: Time -> [ParamPattern] -> ParamPattern Source #
stut :: Pattern Integer -> Pattern Double -> Pattern Rational -> ParamPattern -> ParamPattern Source #
Stut applies a type of delay to a pattern. It has three parameters, which could be called depth, feedback and time. Depth is an integer and the others floating point. This adds a bit of echo:
d1 $ stut 4 0.5 0.2 $ sound "bd sn"
The above results in 4 echos, each one 50% quieter than the last, with 1/5th of a cycle between them. It is possible to reverse the echo:
d1 $ stut 4 0.5 (-0.2) $ sound "bd sn"
_stut :: Integer -> Double -> Rational -> ParamPattern -> ParamPattern Source #
stut' :: Pattern Int -> Pattern Time -> (Pattern a -> Pattern a) -> Pattern a -> Pattern a Source #
Instead of just decreasing volume to produce echoes, stut'
allows to apply a function for each step and overlays the result delayed by the given time.
d1 $ stut' 2 (1%3) (# vowel "{a e i o u}%2") $ sound "bd sn"
In this case there are two _overlays_ delayed by 1/3 of a cycle, where each has the vowel
filter applied.
_stut' :: (Num n, Ord n) => n -> Time -> (Pattern a -> Pattern a) -> Pattern a -> Pattern a Source #
durPattern :: Pattern a -> Pattern Time Source #
durPattern
takes a pattern and returns the length of events in that
pattern as a new pattern. For example the result of `durPattern "[a ~] b"`
would be `"[0.25 ~] 0.5"`.
durPattern' :: Pattern a -> Pattern Time Source #
durPattern'
is similar to durPattern
, but does some lookahead to try
to find the length of time to the *next* event. For example, the result of
durPattern
"[a ~] b"` would be `"[0.5 ~] 0.5"`.
stutx :: Pattern Int -> Pattern Time -> (Pattern a -> Pattern a) -> Pattern a -> Pattern a Source #
stutx
is like stut'
but will limit the number of repeats using the
duration of the original sound. This usually prevents overlapping "stutters"
from subsequent sounds.
anticipateIn :: Time -> Time -> [ParamPattern] -> ParamPattern Source #
same as anticipate
though it allows you to specify the number of cycles until dropping to the new pattern, e.g.:
d1 $ sound "jvbass(3,8)" t1 (anticipateIn 4) $ sound "jvbass(5,8)"
anticipate :: Time -> [ParamPattern] -> ParamPattern Source #
anticipate
is an increasing comb filter.
Build up some tension, culminating in a _drop_ to the new pattern after 8 cycles.
nToOrbit :: ParamPattern -> ParamPattern Source #
Copies the n
parameter to the orbit
parameter, so different sound variants or notes go to different orbits in SuperDirt.
soundToOrbit :: [String] -> ParamPattern -> ParamPattern Source #
Maps the sample or synth names to different orbit
s, using indexes from the given list. E.g. soundToOrbit ["bd", "sn", "cp"] $ sound "bd [cp sn]"
would cause the bd, sn and cp smamples to be sent to orbit 0, 1, 2 respectively.
jux :: (ParamPattern -> Pattern ParamMap) -> ParamPattern -> Pattern ParamMap Source #
The jux
function creates strange stereo effects, by applying a
function to a pattern, but only in the right-hand channel. For
example, the following reverses the pattern on the righthand side:
d1 $ slow 32 $ jux (rev) $ striate' 32 (1/16) $ sound "bev"
When passing pattern transforms to functions like jux and every,
it's possible to chain multiple transforms together with .
, for
example this both reverses and halves the playback speed of the
pattern in the righthand channel:
d1 $ slow 32 $ jux ((# speed "0.5") . rev) $ striate' 32 (1/16) $ sound "bev"
juxcut :: (ParamPattern -> Pattern ParamMap) -> ParamPattern -> Pattern ParamMap Source #
jux' :: [t -> ParamPattern] -> t -> Pattern ParamMap Source #
In addition to jux
, jux'
allows using a list of pattern transform. resulting patterns from each transformation will be spread via pan from left to right.
For example:
d1 $ jux' [iter 4, chop 16, id, rev, palindrome] $ sound "bd sn"
will put `iter 4` of the pattern to the far left and palindrome
to the far right. In the center the original pattern will play and mid left mid right the chopped and the reversed version will appear.
One could also write:
d1 $ stack [ iter 4 $ sound "bd sn" # pan "0", chop 16 $ sound "bd sn" # pan "0.25", sound "bd sn" # pan "0.5", rev $ sound "bd sn" # pan "0.75", palindrome $ sound "bd sn" # pan "1", ]
jux4 :: (ParamPattern -> Pattern ParamMap) -> ParamPattern -> Pattern ParamMap Source #
Multichannel variant of jux
, _not sure what it does_
juxBy :: Pattern Double -> (ParamPattern -> Pattern ParamMap) -> ParamPattern -> Pattern ParamMap Source #
With jux
, the original and effected versions of the pattern are
panned hard left and right (i.e., panned at 0 and 1). This can be a
bit much, especially when listening on headphones. The variant juxBy
has an additional parameter, which brings the channel closer to the
centre. For example:
d1 $ juxBy 0.5 (density 2) $ sound "bd sn:1"
In the above, the two versions of the pattern would be panned at 0.25 and 0.75, rather than 0 and 1.
smash :: Pattern Int -> [Pattern Time] -> ParamPattern -> Pattern ParamMap Source #
Smash is a combination of spread
and striate
- it cuts the samples
into the given number of bits, and then cuts between playing the loop
at different speeds according to the values in the list.
So this:
d1 $ smash 3 [2,3,4] $ sound "ho ho:2 ho:3 hc"
Is a bit like this:
d1 $ spread (slow) [2,3,4] $ striate 3 $ sound "ho ho:2 ho:3 hc"
This is quite dancehall:
d1 $ (spread' slow "1%4 2 1 3" $ spread (striate) [2,3,4,1] $ sound "sn:2 sid:3 cp sid:4") # speed "[1 2 1 1]/2"
spin :: Pattern Int -> ParamPattern -> ParamPattern Source #
spin
will "spin" a layer up a pattern the given number of times, with each successive layer offset in time by an additional `1/n` of a cycle, and panned by an additional `1/n`. The result is a pattern that seems to spin around. This function works best on multichannel systems.
d1 $ slow 3 $ spin 4 $ sound "drum*3 tabla:4 [arpy:2 ~ arpy] [can:2 can:3]"
_spin :: Int -> ParamPattern -> ParamPattern Source #
scale :: (Functor f, Num b) => b -> b -> f b -> f b Source #
scale
will take a pattern which goes from 0 to 1 (like sine1
), and scale it to a different range - between the first and second arguments. In the below example, `scale 1 1.5` shifts the range of sine1
from 0 - 1 to 1 - 1.5.
d1 $ jux (iter 4) $ sound "arpy arpy:2*2" |+| speed (slow 4 $ scale 1 1.5 sine1)
chop :: Pattern Int -> ParamPattern -> ParamPattern Source #
chop
granualizes every sample in place as it is played, turning a pattern of samples into a pattern of sample parts. Use an integer value to specify how many granules each sample is chopped into:
d1 $ chop 16 $ sound "arpy arp feel*4 arpy*4"
Different values of chop
can yield very different results, depending
on the samples used:
d1 $ chop 16 $ sound (samples "arpy*8" (run 16)) d1 $ chop 32 $ sound (samples "arpy*8" (run 16)) d1 $ chop 256 $ sound "bd*4 [sn cp] [hh future]*2 [cp feel]"
_chop :: Int -> ParamPattern -> ParamPattern Source #
gap :: Pattern Int -> ParamPattern -> ParamPattern Source #
_gap :: Int -> ParamPattern -> ParamPattern Source #
weave :: Rational -> ParamPattern -> [ParamPattern] -> ParamPattern Source #
weave
applies a function smoothly over an array of different patterns. It uses an OscPattern
to
apply the function at different levels to each pattern, creating a weaving effect.
d1 $ weave 3 (shape $ sine1) [sound "bd [sn drum:2*2] bd*2 [sn drum:1]", sound "arpy*8 ~"]
weave' :: Rational -> Pattern a -> [Pattern a -> Pattern a] -> Pattern a Source #
weave'
is similar in that it blends functions at the same time at different amounts over a pattern:
d1 $ weave' 3 (sound "bd [sn drum:2*2] bd*2 [sn drum:1]") [density 2, (# speed "0.5"), chop 16]
interlace :: ParamPattern -> ParamPattern -> ParamPattern Source #
(A function that takes two OscPatterns, and blends them together into a new OscPattern. An OscPattern is basically a pattern of messages to a synthesiser.)
Shifts between the two given patterns, using distortion.
Example:
d1 $ interlace (sound "bd sn kurt") (every 3 rev $ sound "bd sn:2")
step' :: [String] -> String -> Pattern String Source #
like step
, but allows you to specify an array of strings to use for 0,1,2...
slice :: Pattern Int -> Pattern Int -> ParamPattern -> ParamPattern Source #
_slice :: Int -> Int -> ParamPattern -> ParamPattern Source #
randslice :: Int -> ParamPattern -> ParamPattern Source #
loopAt :: Pattern Time -> ParamPattern -> ParamPattern Source #
loopAt
makes a sample fit the given number of cycles. Internally, it
works by setting the unit
parameter to "c", changing the playback
speed of the sample with the speed
parameter, and setting setting
the density
of the pattern to match.
d1 $ loopAt 4 $ sound "breaks125" d1 $ juxBy 0.6 (|*| speed "2") $ slowspread (loopAt) [4,6,2,3] $ chop 12 $ sound "fm:14"
hurry :: Pattern Rational -> ParamPattern -> ParamPattern Source #
(@@) :: Int -> Int -> Sieve Bool infixl 9 Source #
The basic notation for and constructor of a boolean Sieve
is m@@n
,
which represents all integers whose modulo with m
is equal to n
(#^^#) :: Applicative f => f Bool -> f Bool -> f Bool infixl 2 Source #
#^^#
gives the exclusive disjunction (logical XOR) of two sieves
sieveToList :: Int -> Sieve a -> [a] Source #
sieveToList n
returns a list of the values of the sieve for each
nonnegative integer less than n
For example: sieveToList 10 $ 3@@1
returns
`[False, True, False, False, True, False, False, True, False, False]`
sieveToString :: Int -> Sieve Bool -> [Char] Source #
sieveToString n
represents the sieve as a character string, where
-
represents False and x
represents True
sieveToInts :: Int -> Sieve Bool -> [Int] Source #
sieveToInts n
returns a list of nonnegative integers less than n
where the sieve is True
sieveToPat :: Int -> Sieve Bool -> Pattern String Source #
sieveToPat n
returns a pattern where the cycle is divided into n
beats, and there is an event whenever the matching beat number is in the
sieve
For example: sieveToPat 8 $ 3@@1
returns "~ x ~ ~ x ~ ~ x"
stepSieve :: Int -> String -> Sieve Bool -> Pattern String Source #
stepSieve n str
works like sieveToPat
but uses str
in the pattern
instead of x
slowstepSieve :: Pattern Time -> Int -> String -> Sieve Bool -> Pattern String Source #
slowstepSieve t
is shorthand for applying slow t
to the result of
stepSieve
scaleSieve :: Int -> Sieve Bool -> Pattern Int -> Pattern Int Source #
scaleSieve n
uses sieveToInts
to turn a sieve into a list of
integers, and then uses that with the toScale
function to
turn a pattern of numbers into a pattern of notes in the scale.
For example: scaleSieve 8 (3@@1) "0 1 2 1"
first converts the sieve
to the scale [1, 4, 7]
and then uses that with toScale
to return the
pattern "1 4 7 4"
sendEspTempo :: Real t => t -> IO () Source #
dirtStreamEsp :: IO (ParamPattern -> IO ()) Source #
stateEsp :: Backend a -> Shape -> IO (MVar (ParamPattern, [ParamPattern])) Source #
dirtSettersEsp :: IO Time -> IO (ParamPattern -> IO (), (Time -> [ParamPattern] -> ParamPattern) -> ParamPattern -> IO ()) Source #
superDirtSettersEsp :: IO Time -> IO (ParamPattern -> IO (), (Time -> [ParamPattern] -> ParamPattern) -> ParamPattern -> IO ()) Source #
data StreamType Source #
changeStreamType :: MVar StreamType -> StreamType -> IO (IO StreamType) Source #
multiModeSetters :: IO Rational -> IO Rational -> MVar SyncType -> MVar StreamType -> IO (ParamPattern -> IO ()) Source #
tidal_version :: [Char] Source #