Map (Int, Int) Int. Kind of a bad example because tuples have special-case infix syntax, the general case would be Map Int (Either Int Bool). Follows the same exact syntax as function application just that types (by enforced convention) start upper case. Modulo technical wibbles to ensure that type inference is possible you can consider type constructors to be functions from types to types.
…function application syntax is a story in itself in Haskell because foo ab c gets desugared to (((foo a) b) c): There’s only one-argument functions. If you want to have more arguments, accept an argument and return a function that accepts yet another argument. Then hide all that under syntactic sugar so that it looks innocent. And, of course, optimise it away when compiling. Thus you can write stuff like map (+5) xs in Haskell while other languages need the equivalent of map (\x -> x + 5) xs (imagine the \ is a lambda symbol).
Map (Int, Int) Int
. Kind of a bad example because tuples have special-case infix syntax, the general case would beMap Int (Either Int Bool)
. Follows the same exact syntax as function application just that types (by enforced convention) start upper case. Modulo technical wibbles to ensure that type inference is possible you can consider type constructors to be functions from types to types.…function application syntax is a story in itself in Haskell because
foo a b c
gets desugared to(((foo a) b) c)
: There’s only one-argument functions. If you want to have more arguments, accept an argument and return a function that accepts yet another argument. Then hide all that under syntactic sugar so that it looks innocent. And, of course, optimise it away when compiling. Thus you can write stuff likemap (+5) xs
in Haskell while other languages need the equivalent ofmap (\x -> x + 5) xs
(imagine the\
is a lambda symbol).Interesting. Thanks!