hmt-base-0.20: Haskell Music Theory Base
Safe HaskellSafe-Inferred
LanguageHaskell2010

Music.Theory.Tuple

Description

Tuple functions.

Uniform tuples have types T2, T3 etc. and functions names are prefixed t2_ etc.

Heterogenous tuples (products) are prefixed p2_ etc.

Synopsis

P2 (2-product)

p2_from_list :: (t -> t1, t -> t2) -> [t] -> (t1, t2) Source #

p2_swap :: (s, t) -> (t, s) Source #

Swap elements of P2

p2_swap (1,2) == (2,1)

T2 (2-tuple, regular)

type T2 a = (a, a) Source #

Uniform two-tuple.

t2_from_list :: [t] -> T2 t Source #

t2_to_list :: T2 a -> [a] Source #

t2_swap :: T2 t -> T2 t Source #

t2_map :: (p -> q) -> T2 p -> T2 q Source #

t2_zipWith :: (p -> q -> r) -> T2 p -> T2 q -> T2 r Source #

t2_infix :: (a -> a -> b) -> T2 a -> b Source #

t2_join :: Monoid m => T2 m -> m Source #

t2_infix mappend.

t2_join ([1,2],[3,4]) == [1,2,3,4]

t2_concat :: Monoid m => [T2 m] -> T2 m Source #

t2_map mconcat of unzip

t2_concat [("ab","cd"),("ef","gh")] == ("abef","cdgh")

t2_sort :: Ord t => (t, t) -> (t, t) Source #

sort

t2_sort (2,1) == (1,2)

t2_sum :: Num n => (n, n) -> n Source #

t2_mapM :: Monad m => (t -> m u) -> (t, t) -> m (u, u) Source #

t2_mapM_ :: Monad m => (t -> m u) -> (t, t) -> m () Source #

P3 (3-product)

p3_rotate_left :: (s, t, u) -> (t, u, s) Source #

Left rotation.

p3_rotate_left (1,2,3) == (2,3,1)

p3_fst :: (a, b, c) -> a Source #

p3_snd :: (a, b, c) -> b Source #

p3_third :: (a, b, c) -> c Source #

T3 (3 triple, regular)

type T3 a = (a, a, a) Source #

t3_from_list :: [t] -> T3 t Source #

t3_to_list :: T3 a -> [a] Source #

t3_fst :: T3 t -> t Source #

t3_snd :: T3 t -> t Source #

t3_third :: T3 t -> t Source #

t3_map :: (p -> q) -> T3 p -> T3 q Source #

t3_zipWith :: (p -> q -> r) -> T3 p -> T3 q -> T3 r Source #

t3_infix :: (a -> a -> a) -> T3 a -> a Source #

t3_join :: T3 [a] -> [a] Source #

t3_sort :: Ord t => (t, t, t) -> (t, t, t) Source #

P4 (4-product)

p4_fst :: (a, b, c, d) -> a Source #

p4_snd :: (a, b, c, d) -> b Source #

p4_third :: (a, b, c, d) -> c Source #

p4_fourth :: (a, b, c, d) -> d Source #

p4_zip :: (a, b, c, d) -> (e, f, g, h) -> ((a, e), (b, f), (c, g), (d, h)) Source #

T4 (4-tuple, regular)

type T4 a = (a, a, a, a) Source #

t4_from_list :: [t] -> T4 t Source #

t4_to_list :: T4 t -> [t] Source #

t4_fst :: T4 t -> t Source #

t4_snd :: T4 t -> t Source #

t4_third :: T4 t -> t Source #

t4_fourth :: T4 t -> t Source #

t4_map :: (p -> q) -> T4 p -> T4 q Source #

t4_zipWith :: (p -> q -> r) -> T4 p -> T4 q -> T4 r Source #

t4_infix :: (a -> a -> a) -> T4 a -> a Source #

t4_join :: T4 [a] -> [a] Source #

P5 (5-product)

p5_fst :: (a, b, c, d, e) -> a Source #

p5_snd :: (a, b, c, d, e) -> b Source #

p5_third :: (a, b, c, d, e) -> c Source #

p5_fourth :: (a, b, c, d, e) -> d Source #

p5_fifth :: (a, b, c, d, e) -> e Source #

p5_from_list :: (t -> t1, t -> t2, t -> t3, t -> t4, t -> t5) -> [t] -> (t1, t2, t3, t4, t5) Source #

p5_to_list :: (t1 -> t, t2 -> t, t3 -> t, t4 -> t, t5 -> t) -> (t1, t2, t3, t4, t5) -> [t] Source #

T5 (5-tuple, regular)

type T5 a = (a, a, a, a, a) Source #

t5_from_list :: [t] -> T5 t Source #

t5_to_list :: T5 t -> [t] Source #

t5_map :: (p -> q) -> T5 p -> T5 q Source #

t5_fst :: T5 t -> t Source #

t5_snd :: T5 t -> t Source #

t5_fourth :: T5 t -> t Source #

t5_fifth :: T5 t -> t Source #

t5_infix :: (a -> a -> a) -> T5 a -> a Source #

t5_join :: T5 [a] -> [a] Source #

P6 (6-product)

p6_fst :: (a, b, c, d, e, f) -> a Source #

p6_snd :: (a, b, c, d, e, f) -> b Source #

p6_third :: (a, b, c, d, e, f) -> c Source #

p6_fourth :: (a, b, c, d, e, f) -> d Source #

p6_fifth :: (a, b, c, d, e, f) -> e Source #

p6_sixth :: (a, b, c, d, e, f) -> f Source #

T6 (6-tuple, regular)

type T6 a = (a, a, a, a, a, a) Source #

t6_from_list :: [t] -> T6 t Source #

t6_to_list :: T6 t -> [t] Source #

t6_map :: (p -> q) -> T6 p -> T6 q Source #

t6_sum :: Num t => T6 t -> t Source #

T7 (7-tuple, regular)

type T7 a = (a, a, a, a, a, a, a) Source #

t7_to_list :: T7 t -> [t] Source #

t7_map :: (p -> q) -> T7 p -> T7 q Source #

T8 (8-tuple, regular)

type T8 a = (a, a, a, a, a, a, a, a) Source #

t8_to_list :: T8 t -> [t] Source #

t8_map :: (p -> q) -> T8 p -> T8 q Source #

P8 (8-product)

p8_third :: (a, b, c, d, e, f, g, h) -> c Source #

T9 (9-tuple, regular)

type T9 a = (a, a, a, a, a, a, a, a, a) Source #

t9_to_list :: T9 t -> [t] Source #

t9_from_list :: [t] -> T9 t Source #

t9_map :: (p -> q) -> T9 p -> T9 q Source #

T10 (10-tuple, regular)

type T10 a = (a, a, a, a, a, a, a, a, a, a) Source #

t10_to_list :: T10 t -> [t] Source #

t10_map :: (p -> q) -> T10 p -> T10 q Source #

T11 (11-tuple, regular)

type T11 a = (a, a, a, a, a, a, a, a, a, a, a) Source #

t11_to_list :: T11 t -> [t] Source #

t11_map :: (p -> q) -> T11 p -> T11 q Source #

T12 (12-tuple, regular)

type T12 t = (t, t, t, t, t, t, t, t, t, t, t, t) Source #

t12_to_list :: T12 t -> [t] Source #

t12_foldr1 :: (t -> t -> t) -> T12 t -> t Source #

foldr1 of t12_to_list.

t12_foldr1 (+) (1,2,3,4,5,6,7,8,9,10,11,12) == 78

t12_sum :: Num n => T12 n -> n Source #

sum of t12_to_list.

t12_sum (1,2,3,4,5,6,7,8,9,10,11,12) == 78

Family of uncurry functions.

uncurry3 :: (a -> b -> c -> z) -> (a, b, c) -> z Source #

uncurry4 :: (a -> b -> c -> d -> z) -> (a, b, c, d) -> z Source #

uncurry5 :: (a -> b -> c -> d -> e -> z) -> (a, b, c, d, e) -> z Source #

uncurry6 :: (a -> b -> c -> d -> e -> f -> z) -> (a, b, c, d, e, f) -> z Source #

uncurry7 :: (a -> b -> c -> d -> e -> f -> g -> z) -> (a, b, c, d, e, f, g) -> z Source #

uncurry8 :: (a -> b -> c -> d -> e -> f -> g -> h -> z) -> (a, b, c, d, e, f, g, h) -> z Source #

uncurry9 :: (a -> b -> c -> d -> e -> f -> g -> h -> i -> z) -> (a, b, c, d, e, f, g, h, i) -> z Source #

uncurry10 :: (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> z) -> (a, b, c, d, e, f, g, h, i, j) -> z Source #

uncurry11 :: (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> z) -> (a, b, c, d, e, f, g, h, i, j, k) -> z Source #

uncurry12 :: (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> z) -> (a, b, c, d, e, f, g, h, i, j, k, l) -> z Source #

uncurry13 :: (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> z) -> (a, b, c, d, e, f, g, h, i, j, k, l, m) -> z Source #

uncurry14 :: (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> z) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> z Source #

uncurry15 :: (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> z) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> z Source #

uncurry16 :: (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> z) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) -> z Source #

uncurry17 :: (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> z) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) -> z Source #

uncurry18 :: (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> z) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) -> z Source #

uncurry19 :: (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> z) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) -> z Source #

uncurry20 :: (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> t -> z) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) -> z Source #