I can declare empty list as [], but, how can I declare empty tuple?
I have tried:
for ( , )
ghci>(1,0 ) : [(,)]
but it gives me an error!
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.
A tuple is a type that is always the same length and always has the same types. So
(Int, Int)is a different type from(Int, Int, Int)and a different type from(Int, String).With this in mind, you could have an empty tuple. However, this would just be a type with a single value. This type is written as
()and pronounced unit. The only value of this type is also().