Okay so this might a super naive question but I'm not really into the programming languages world, but looking up the manual for all the functions in tidal I couldn't find a way of understanding how to interpret these terms, which lay beside every function. like if I read lpf :: Pattern Double -> ControlPattern, how should I actually use it? Hope I've been somewhat clear, thanks in advance to whoever will read me!
Hi! Those are the type signatures for each function, describing the data types for the function’s inputs and outputs. This documentation page should help explain things further.
I would like to extend the answer from the documentation (so looking to the documentation from @archaic.tech first, would be useful).
The documentation tells you (correctly), that the last signature element is the return value. So for examlpe
:t fast 2
-- fast 2 :: Pattern a -> Pattern a
means that fast 2 expects one more pattern to return a pattern.
When we look into d1 then we will see, why something like d1 $ fast 2 will produces an error:
:t d1
-- d1 :: Pattern ValueMap -> IO ()
d1 expects the specific Pattern ValueMap and this is equal to ControlPattern and returns an IO() (creates the OSC messages as a stream inside Tidal) type.
type ControlPattern = Pattern ValueMap
That means you need the result type ControlPattern to use i.e. d1. When you look to functions like s, n, lpf etc. then you see why d1 $ s "bd" or d1 $ lpf 3000 works:
:t s
--s "Pattern String -> ControlPattern
:t s "bd"
-- s "bd" :: ControlPattern
And because ControlPattern = Pattern ValueMap you can use it with d1
:t d1 $ s "bd"
-- d1 $ s "bd" :: IO()
I think this is everything you need to know for understanding the usage of ControlPattern. Everything beside this goes deeper to the innards I guess 