by MartinMond · 3y ago · 0 comments
Consider these two function signatures:
map :: ([a] -> [a])
map :: ([int] -> [int])
Furthermore the syntax that Elixir uses here let's you do something like
map :: (list(a) -> list(b))
list_to_other_data_structure :: (list(a) -> other_data_structure(a))
It all reminds me a bit of how Haskell does it https://medium.com/functional/haskell-basic-types-and-type-v...
I'm now curious to know if/how the above 'generics' would be expressed in TypeScript/Python/Go without a similar 'type constructor' syntax construct?
map :: forall a. ([a] -> [a])
or
map :: <a> ([a] -> [a])