Functions with multiple arguments

Hello everyone!
When I control visuals (Processing, Unreal Engine) with Tidal, using OSC, I create functions like these
red = pF "red"
green = pF "green"
blue = pF "blue"
Is it possible to create functions with multiple arguments?, similar to "stut"
$ stut 8 0.5 0.5
A function that calls it like this
# rgb 0.5 1 0.25

This is an example of a DAW-style visualizer for Tidal courses:

thanks in advance
Ivan Abreu

Hey @ivanabreu !

Yes you should be able to define this like:

import Data.Colour.SRGB

let red = pF "red"
    green = pF "green"
    blue = pF "blue"
    rgb r g b = red r # green g # blue b
    colour :: Pattern ColourD -> ControlPattern
    colour pat = do (RGB r g b) <- toSRGB <$> pat
                    red (pure r) # green (pure g) # blue (pure b)

With the above you can not only do # rgb 0.5 1 0.25

but also # colour "red green tomato seagreen orange"

The available names are here: Data.Colour.Names

1 Like

Hi Alex!!!. thank you very much dear friend.
I appreciate your valuable time.

1 Like

I just added a missing line to the above (import Data.Colour.SRGB)

1 Like