Custom functions - type signatures

I had the following functions working:

let drumMappings = [("b","c3"),("s","cs3"),("sl","d3"),("sr","f3"),("st","fs3"),("hp","c4"),("hpo","b4"),("hc","d4"),("hhc","e4"),("hb","f4"),("hho","fs4"),("hho1","g4"),("hho2","gs4"),("ho","a4"),("hob","as4"),("r","c5"),("rb","cs5"),("rc","d5"),("rm","ds5"),("t1","b5"),("t2","a5"),("t3","g5"),("t4","f5"),("c1","f6"),("c1m","fs6"),("c2","g6"),("c2m","gs6"),("ch","a6"),("chm","as6"),("sp","f7"), ("w","c8"), ("conga", "b3")]
    dMap notes = (inhabit drumMappings notes)
    drumChannel = 0
    d myNotes myAmp = d1 $ n (dMap myNotes) #s "midi" #midichan drumChannel #amp myAmp

which let me send MIDI to a drum VST with less typing

d "b s hho" 0.5

instead of

d1 $ n "c3 cs3 fs4" #s "midi" #midichan 0 #amp 0.5

I want to specify the pattern number with a new parameter (i.e. not always $d1). I got this:

d myPatternNumber myNotes myAmp = p myPatternNumber $ n (dMap myNotes) #s "midi" #midichan dChannel #amp myAmp

However, if I try

d 1 "b s hho" 0.5

I get an error:

Warning: GHCi | 
Warning: GHCi | <interactive>:5577:1: error:
Warning: GHCi |     * Could not deduce (Num t0)
Warning: GHCi |       from the context: (Num t, Num (t -> Pattern ValueMap -> b))
Warning: GHCi |         bound by the inferred type for `it':
Warning: GHCi |                    forall {t} {b}. (Num t, Num (t -> Pattern ValueMap -> b)) => b
tidal> Warning: GHCi |         at <interactive>:5577:1-17
Warning: GHCi |       The type variable `t0' is ambiguous
Warning: GHCi |       Potentially matching instances:
Warning: GHCi |         instance Integral a => Num (Ratio a) -- Defined in `GHC.Real'
Warning: GHCi |         instance Num Note -- Defined in `Sound.Tidal.Pattern'
Warning: GHCi | 7 others
Warning: GHCi | 33 instances involving out-of-scope types
Warning: GHCi |         (use -fprint-potential-instances to see them all)
Warning: GHCi |     * In the ambiguity check for the inferred type for `it'
Warning: GHCi |       To defer the ambiguity check to use sites, enable AllowAmbiguousTypes
Warning: GHCi |       When checking the inferred type
Warning: GHCi |         it :: forall {t} {b}.
Warning: GHCi |               (Num t, Num (t -> Pattern ValueMap -> b)) =>
Warning: GHCi |               b

Any ideas on how to implement this? Thanks!

FWIW, I briefly tried your functions yesterday and was unable to reproduce the issue.

One question: what version of Tidal are you using?

Thanks for trying it out! I'm using 1.9.2. What version are you using?

1.9.2 as well.

Though these things really shouldn’t have an impact, I might as well also ask: what GHC version are you running? (9.4.2 here, which reminds me that I should soon install some updates.)

I've just reinstalled tidal with chocolatey. Now I'm getting errors with qtrigger; has that happened to anyone?

Yes, it's likely due to this change:

Yes you don't need to specify the pattern id any more Trigger a pattern from the start | Tidal Cycles