Can’t figure out the syntax here.
foo: String -> String -> String
foo is a function that takes two string args and returns string
Similarly,
bar: String -> (String -> String)
bar is a function that takes a String and returns a function that takes in a string and returns a string.
How do u say/describe Html Msg ?
So can i write something like foo Msg ?
Like foo produces Msg?
I think of Html Msg as an "Html document which can emit messages of type Msg".
Also, due to types being right-associative and function application being left-associative in elm, both foo and bar in your example actually have the same type.
foo : String -> String -> String is the same as foo : String -> (String -> String) and (foo "a") "b" is the same as foo "a" "b"
Also some other events can cause that type of message, such as http requests, but all messages that originate from that document will have that same type.
Html Msg is a type; Html is not a function. Some types like Html have arguments that contain other types; in this case Msg is a type. Another example of a type that accepts an argument is List. For example, List Int is a list of integers.
And no, you can’t pass a type as a function argument.