Sound.Tidal.Utils
writeError
writeError :: String -> IO ()
mapBoth
mapBoth :: (a -> a) -> (a, a) -> (a, a)
mapPartTimes
mapPartTimes :: (a -> a) -> ((a, a), (a, a)) -> ((a, a), (a, a))
mapFst
mapFst :: (a -> b) -> (a, c) -> (b, c)
mapSnd
mapSnd :: (a -> b) -> (c, a) -> (c, b)
delta
delta :: Num a => (a, a) -> a
mid
mid :: Fractional a => (a, a) -> a
The midpoint of two values
removeCommon
removeCommon :: Eq a => [a] -> [a] -> ([a], [a])
readMaybe
readMaybe :: Read a => String -> Maybe a
(!!!)
(!!!) :: [a] -> Int -> a
like !! selects nth element from xs, but wraps over at the end of xs
>>> map ((!!!) [1,3,5]) [0,1,2,3,4,5]
[1,3,5,1,3,5]
nth
nth :: Int -> [a] -> Maybe a
Safer version of !! -
accumulate
accumulate :: Num t => [t] -> [t]
enumerate
enumerate :: [a] -> [(Int, a)]
enumerate a list of things
>>> enumerate ["foo","bar","baz"]
[(1,"foo"), (2,"bar"), (3,"baz")]
wordsBy
wordsBy :: (a -> Bool) -> [a] -> [[a]]
split given list of a by given single a, e.g.
>>> wordsBy (== ':') "bd:3"
["bd", "3"]
matchMaybe
matchMaybe :: Maybe a -> Maybe a -> Maybe a
fromRight
fromRight :: b -> Either a b -> b