Difference of [Char] and String in Tidal

I'm quite new here, both actually here as well as in tidal AND in Haskell, so this question might actually still be over my head...

I was wondering why I get the following output:

tidal> :t "ha" :: Pattern String
"ha" :: Pattern String :: Pattern String

but if I do:

tidal> :t ['h','a'] :: Pattern String
<interactive>:1.2: error:
   * Couldn't match expected type 'Pattern String' with actual type '[Char]'
   * In the expression: ['h','a'] :: Pattern String

I thought that any String is only a [Char], it arose when I tried doing something like:

p 1234 $ s $ "kick kick " ++ "kick"

As I mentioned above the answer to that could be over my head, but this way I might actually learn something :smiley:

Thank you for your time and have a nice week :ringer_planet:


I know that there are pattern operators like explained in Pattern Structure | Tidal Cycles, I just wondered why I can't use my default String/List functions with tidal

Edit 2:
In conjunction with Casting [Char] to Pattern Note I saw that

tidal> :t parseBP_E ['h','a'] :: Pattern String
parseBP_E ['h','a'] :: Pattern String :: Pattern String

actually solves my problem, but still the question persists why String to Pattern String can be inferred but [Char] to Pattern String can't be inferred :sweat_smile:

Heh looks like you have it solved! The answer to your final question is that it's just a bit of a hack, using a ghc extension 'overloaded strings'. parseBP_E gets automatically called to turn strings into patterns but only at 'compile time', when haskell sees an explicit string in double quotes. In general, type conversions only happen via an explicit function so I don't think this hack can be pushed further to convert all strings to patterns on demand.