[EDIT] A-ha, I understand the design now. Probably understood it some time in the past. Still, perhaps it's entertaining to read:
I was wondering why #
(a.k.a. |>
) has this type
(|> ) :: Unionable a => Pattern a -> Pattern a -> Pattern a
It is advertised (well, not exactly, but there's a comment in the code) as "structure from left, values from right", so the values from the left should not play any role. I expect that to show up in the type as well. Indeed, isn't this a valid implementation
f p q = (\l r -> r) <$> p Sound.Tidal.Context.<* q
f :: Pattern a -> Pattern b -> Pattern b
Here, already the type shows that values from left are irrelevant. This test shows equivalence?
f (run 3) (run 4)
(0>¼)-⅓|0
0-(¼>⅓)|1
(⅓>½)-⅔|1
⅓-(½>⅔)|2
(⅔>¾)-1|2
⅔-(¾>1)|3
run 3 # run 4
(0>¼)-⅓|0
0-(¼>⅓)|1
(⅓>½)-⅔|1
⅓-(½>⅔)|2
(⅔>¾)-1|2
⅔-(¾>1)|3
But no - union
on ControlMap
is different, and that's what's typically used in code:
(s "bd" ) # (gain "1")
(0>1)|gain: 1.0f, s: "bd" -- what we want
f (s "bd" ) (gain "1")
(0>1)|gain: 1.0f -- my implementation