Search code examples
haskellfunction-definition

What does 'p' represent in a function's type?


Given the following function definition:

f xs = []

its type is

f :: p -> [a]

From this, how should you interpret what p means?

Does it just mean anything? As in, f takes in literally-any-value and returns a list?


Solution

  • Yes, p can be any type. Important to note that a is any type possibly other than p, as @bereal has mentioned in thr comments