How does Haskell code work even without the Type declaration?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Note: I’m assuming that you mean type signatures because if you remove type definitions like
type Foo = Barordata X = Y, the code will not work anymore (assuming the defined type is actually used of course).Haskell code works without type signatures because the type of a variable/function is simply inferred by the compiler if you do not specify a signature. The algorithm used to make this inference is a variant of the Hindley-Milner type inference algorithm.