Hello, I'd like to ask you a question about overlay.
d1 $ sound ( overlay "bd sn:2" "cp*3" )
I hear it's the same as d1 $ sound ("bd sn:2" <> "cp*3")
I'm going to use <> in the tidal cycle, but it is not recognized.
How can overlay operator <> use code?
what error message are you receiving? If I do this with vanilla settings I get
Ambiguous occurrence ‘<>’
It could refer to
either ‘Sound.Tidal.Context.<>’,
imported from ‘Sound.Tidal.Context’
(and originally defined in ‘Sound.Tidal.Core’)
or ‘Prelude.<>’,
imported from ‘Prelude’ (and originally defined in ‘GHC.Base’)
In this case, the problem is that the operator <> is defined both in Prelude (which is a set of standard functions that are automatically imported) and in Sound.Tidal.Context (which is the one you want to use). Consequently the compiler does not know which version of <> you want to use and you have to do this explicitly. To do that you have several options:
Why does Sound.Tidal.Core redefine <> and not simply make Pattern a an instance of Semigroup? I guess you could argue that Pattern a does have many binary operators that qualify as semigroup but then, why choose <> to be the operator for overlay?
Hi @fnab,
There is no good reason, apart from I don't really know what Semigroup is. I remember there was some structural change with this package that caused some build errors a while ago. I guess that was the point that <> from Semigroup came into scope and broke things. If <> has the same meaning in both packages that's a happy coincidence. I'd happily accept a pull request that defines a pattern as a semigroup instance, if that improves things!